Assignment 12
Due Monday, May 17 at 9:20am on Canvas

Assignment 12.1: Little Boy Blue (10 pts)

Denslow-little-boy-blue2.jpg Create a new C++ file called blue.cpp.
Write a program that uses a while loop to print the numbers from 1 to 150, with each number printed on its own line.
For multiples of 3 print "Little Boy Blue" instead of the number
For the multiples of 5 print "Come Blow Your Horn" instead of the number.
For numbers which are multiples of both 3 and 5 print "The Sheep's in the Meadow. The Cow's in the Corn."
You must use a while loop for full credit.
Hint: Test for numbers that are multiples of both 3 and 5 first.

When you are finished, and your output looks like mine, upload your assignment to Canvas.




Your Output Should Look Like the Following. Note that some values have been omitted for brevity.

1
2
Little Boy Blue
4
Come Blow Your Horn
Little Boy Blue
7
8
Little Boy Blue
Come Blow Your Horn
11
Little Boy Blue
13
14
The Sheep's in the Meadow. The Cow's in the Corn.
16
17
Little Boy Blue
19
Come Blow Your Horn
Little Boy Blue
22
...
149
The Sheep's in the Meadow. The Cow's in the Corn.


Assignment 12.2: Rock Paper Scissors (10 pts)

  • Write a program to simulate a Rock, Paper, Scissors competition between two players.
  • Your file should be named RPS.cpp and should be uploaded to Canvas when you are finished.
  • First, the program will welcome them to the competition.
Let's play Rock-Paper-Scissors!
  • Then, the program will prompt each user to enter his or her name.
Player one, please enter your name: _
  • Next, the program will ask each user (referring to him or her by name) to enter "Rock," "Paper" or "Scissors."
Jorge, please enter "Rock", "Paper" or "Scissors": _
  • Important: Note the use of the player name above and the " marks.
  • The program will determine who the winner is and output one of three options:
Rock breaks scissors!
Paper covers rock!
Scissors cut paper!
  • How will the program determine the winner? Hint: if - else if - else statements and using logical operators (&&, ||, !).
  • After outputting the above statement, the program will announce the winner by name:
Jorge wins!
  • In the case of a tie, the program should announce that the result is a draw.
The game is a tie.
  • Important: You are required to use logical operators (&&, ||, !) as part of your if  and else if statements.
  • The program should also prompt the user to decide if they want to play again (Hint: use a while loop).
  • Your program should work identically to the following examples:


Rock-Paper-Scissors Round 1!

Player one, please enter your name: Jorge
Player two, please enter your name: Jennifer
Jorge, enter "Rock", "Paper", or "Scissors": Rock
Jennifer, enter "Rock", "Paper", or "Scissors": Scissors
Rock breaks scissors!
Jorge wins!

Do you want to play again (y/n): y

Rock-Paper-Scissors Round 2!

Player one, please enter your name: Jorge
Player two, please enter your name: Jennifer
Jorge, enter "Rock", "Paper", or "Scissors": Scissors
Jennifer, enter "Rock", "Paper", or "Scissors": Scissors
It's a tie!

Do you want to play again (y/n): y

Rock-Paper-Scissors Round 3!

Player one, please enter your name: Wen
Player two, please enter your name: Amelia
Wen, enter "Rock", "Paper", or "Scissors": Rock
Amelia, enter "Rock", "Paper", or "Scissors": Paper
Paper covers rock!
Amelia wins!

Do you want to play again (y/n): n
Thanks for playing!