Skip to content

Programming by Design

If you're not prepared to be wrong, you'll never come up with anything original. – Sir Ken Robinson

  • About
  • Java-PbD
  • C-PbD
  • ASM-PbD
  • Algorithms
  • Other

CISS-110 Project 4

Posted on December 31, 2022January 20, 2025 By William Jojo
CISS-110-Project
CISS-110 Project 4

This is the game of Boulder, Parchment, Shears! Yes, the one from Critical Role based on Rock, Paper, Scissors.

This project deals with a range-based for loop where we know the exact number of times a loop will iterate (perform the associated block of code). You will also use an if/else construct to determine the winner.


Learning outcomes

  • Implementing loops.
  • Implementing conditional constructs.
  • Using random numbers.
  • Working with strings and string operations.
  • Confirmation program produces desired results.

The standard rules apply. Boulder beats Shears, Shears beats Parchment, and Parchment beats Boulder.

Here is a set of variables to get you started:

        char player, computer;
        String choices = "BPS";
        String[] names = {"BOULDER", "PARCHMENT", "SHEARS"};
        int numGames, game, wins=0;

Begin by asking the user how many games they wish to play and setting up the for loop based on that value. Within the loop is the general gameplay:

  • Prompt and read for their choice. You should notify the user if they have made an invalid choice – which ends that game.
  • Randomly select the computer’s choice.
  • Determine the winner or a draw.
  • Keep track of the player’s wins.
Beginning advice.
It is advantageous to work out the details of getting user input, the computer’s random choice, and determining the winner before involving the loop.

Here is a sample run that your program would produce. The user input is bold italic.

This is the game of Boulder Parchment Shears!
How many games do you wish to play? 5

Game #1
Please choose B, P, or S: o
Invalid choice!

Game #2
Please choose B, P, or S: p
It's a draw!

Game #3
Please choose B, P, or S: s
Computer wins with BOULDER!

Game #4
Please choose B, P, or S: p
Computer wins with SHEARS!

Game #5
Please choose B, P, or S: s
Computer had PARCHMENT. You won with SHEARS.

You won 1 out of 5 games.
Thanks for playing!

Submit the project to the Learning Management System as Project4_lastname.java.

Post navigation

❮ Previous Post: Network Configuration for VMs
Next Post: CISS-111 Project 2 ❯

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Copyright © 2018 – 2025 Programming by Design.