Project One Draft

docx

School

Southern New Hampshire University *

*We aren’t endorsed by this school

Course

205

Subject

Computer Science

Date

Dec 6, 2023

Type

docx

Pages

3

Uploaded by CaptainSteelSeaUrchin27

Report
1 Project One: Pseudocode
2 Project One: Pseudocode 1. Start the game. 2. The program will initialize variables for 1) userTotal, 2) compTotal, 3) tieTotal and 4) i and set them all to zero. userTotal will be the variable to hold the value of the number of wins for the user. compTotal will be the variable to hold the value of the number of wins for the computer. tieTotal will be the variable to hold the value of the number of ties between the user and the computer. i will be the variable to hold the value of the number of iterations that the loop completes. 1. Establish a for loop that will guide the program to continuously repeat the steps of the loop body a total of ten times and then break the loop and proceed to the next steps. 2. This is the first step of the loop body. Prompt the user to input a choice of number 1, 2, or 3, which will represent the user’s symbol in the game. The number 1 represents the symbol of the rock, the number 2 represents the symbol of the paper, and the number 3 represents the symbol of the scissors. 3. Prompt the computer to enter a random number within the range 1 through 3. This will represent the computer’s symbol in the game. The number 1 represents the symbol of the rock, the number 2 represents the symbol of the paper, and the number 3 represents the symbol of the scissors. 4. The next step will be a decision that will compare the user input and the computer input. If the user input is equal to the computer input, the decision will be YES. The program will increment tieTotal by 1 and the program will display the phrase “The End…Tie Wins!” to output. The program will increment i by 1 and the next loop iteration will begin. If the user input and computer input are not equal, the decision will be NO the program will proceed to the next step. 5. This step is also a decision that will compare the user input and the computer input. If the user input is equal to 1 and the computer input is equal to 3, the decision will be YES. The program will increment userToal by 1 and the program will display “The End…You Win!” to output. The program will increment i by 1 and the next loop iteration will begin. If the user input and computer input are not equal to the decision, then the decision will be NO the program will proceed to the next step. 6. This step is the final decision in the loop body that will compare the user input and the computer input. If the user input is equal to 3 and the computer input is equal to 2, increment userTotal by 1 and the program will display “The End…You Win!” to output. The program will increment i by 1 and the next loop iteration will begin. If the user input
3 and computer input are not equal to the decision, then the decision will be NO the program will proceed to the next step. 7. If the user input and computer input are not equal to any of the decisions, the program will increment the compTotal by 1 and the program will display “The End…Computer Wins!” to output. The program will increment i by 1 and the next loop iteration will begin. 8. The program will repeat steps 4-9 for a total of 10 times. 9. After the loop iterates 10 times, the program will break the loop and display the userTotal to output, the compTotal to output, and the tieTotal to output. This will indicate the number of games the user won, the computer won, and the number of games that were a tie. 10. The game will end.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help