Write a program that plays rock, paper, scissors. This is an interactive game between two players....
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a program that plays rock, paper, scissors. This is an interactive game between two players. The sample run provided below represents the user interaction and the output displayed. Important Notes: 1. Your code will use decision-making, nested structures. 2. Both upper- and lower-case letters should be considered. 3. Four cases for player 1: R, P, S and never forget the default case. Within each of the first three cases, there are four cases for player two. 4. Incorporate an iteration method that allows the user to play again, as many times as they like. 5. Your code must demonstrate at least 1 method from the String class Sample output: Test case 1: [NOT A TIE] Let's play Rock, Paper, Scissors. Player 1, Enter your choice: r Player 2, Enter your choice: p Rock v. Paper Player 2 wins again? y Player 1, Enter your choice: P Player 2. Enter your choice: S Let's play Rock, Paper, Scissors. Player 1, Enter your choice: r Player 2, Enter your choice: p Rock v. Paper Player 2 wins. again? y Player 1, Enter your choice: P Player 2, Enter your choice: S Paper v. Scissors. Player 2 wins. again? Y Player 1, Enter your choice: R Player 2, Enter your choice: si Rock v. Scissors. Player 1 wins again? N Nice game! Test case 2: [TIE] Let's play Rock, Paper, Scissors. Player 1, Enter your choice: R Player 2, Enter your choice: R Rock v. Rock It's a TIE again? y Test case 2: [TIE] Let's play Rock, Paper, Scissors. Player 1, Enter your choice: R Player 2, Enter your choice: R Rock v. Rock It's a TIE again? y Player 1, Enter your choice: pi Player 2, Enter your choice: p Paper v. Paper It's a TIE again? n Nice game! Test case 3: [INVALID CHOICE] Let's play Rock, Paper, Scissors. Player 1, Enter your choice: p Player 2, Enter your choice: w Paper v. IERROR: w not a valid mave. ] again? y Player 1, Enter your choice: m [ERROR: m not a valid move.] again? ni Nice game! Write a program that plays rock, paper, scissors. This is an interactive game between two players. The sample run provided below represents the user interaction and the output displayed. Important Notes: 1. Your code will use decision-making, nested structures. 2. Both upper- and lower-case letters should be considered. 3. Four cases for player 1: R, P, S and never forget the default case. Within each of the first three cases, there are four cases for player two. 4. Incorporate an iteration method that allows the user to play again, as many times as they like. 5. Your code must demonstrate at least 1 method from the String class Sample output: Test case 1: [NOT A TIE] Let's play Rock, Paper, Scissors. Player 1, Enter your choice: r Player 2, Enter your choice: p Rock v. Paper Player 2 wins again? y Player 1, Enter your choice: P Player 2. Enter your choice: S Let's play Rock, Paper, Scissors. Player 1, Enter your choice: r Player 2, Enter your choice: p Rock v. Paper Player 2 wins. again? y Player 1, Enter your choice: P Player 2, Enter your choice: S Paper v. Scissors. Player 2 wins. again? Y Player 1, Enter your choice: R Player 2, Enter your choice: si Rock v. Scissors. Player 1 wins again? N Nice game! Test case 2: [TIE] Let's play Rock, Paper, Scissors. Player 1, Enter your choice: R Player 2, Enter your choice: R Rock v. Rock It's a TIE again? y Test case 2: [TIE] Let's play Rock, Paper, Scissors. Player 1, Enter your choice: R Player 2, Enter your choice: R Rock v. Rock It's a TIE again? y Player 1, Enter your choice: pi Player 2, Enter your choice: p Paper v. Paper It's a TIE again? n Nice game! Test case 3: [INVALID CHOICE] Let's play Rock, Paper, Scissors. Player 1, Enter your choice: p Player 2, Enter your choice: w Paper v. IERROR: w not a valid mave. ] again? y Player 1, Enter your choice: m [ERROR: m not a valid move.] again? ni Nice game!
Expert Answer:
Answer rating: 100% (QA)
Step 13 Certainly Heres a C program that implements the Rock Paper Scissors game according to your requirements including the use of switch statements and nested structures for decision making include ... View the full answer
Related Book For
Quantitative Methods for Business
ISBN: 978-0840062345
12th edition
Authors: David Anderson, Dennis Sweeney, Thomas Williams, Jeffrey Cam
Posted Date:
Students also viewed these programming questions
-
A debt of $ 600 due within three years and another of $ 800 due in four years, will be settled by means of a payment within two years. If the interest rate is 8% Composed semi-annually, how much is...
-
Company Revenue for Fiscal Year 2014 (millions of dollars) Walmart 476,294 Exxon Mobil 407,666 Apple 170,910 General Motors 155,427 Ford Motor 146,917 General Electric 146231 Identify and explain...
-
A machine requires three hours to make a unit of Product A and nine hours to make a unit of Product B. Last month the machine operated for 957 hours, producing a total of 145 units. How many units of...
-
List and describe the security and control weaknesses at Sony that are discussed in this case.
-
Vandross Company has recorded bad debt expense in the past at a rate of 1% of net sales. In 2015, Vandross decides to increase its estimate to 2%. If the new rate had been used in prior years,...
-
Evaluate the various housing alternatives that are available.
-
You are the manager of a project to improve a billing process at your firm. Table contains the data you will need to conduct a cost analysis of the project. Indirect costs are $16, 00 per week, and...
-
Please help provide a solution for number 7 thankyou QUESTIONS AND PROBLEMS 1. Assume that the following assets are correctly priced according to the security market line. Derive the security market...
-
In Intuit QuickBooks how do I record this transaction?... Wrote check number 10010 to City Credit Union for payment of amount due (City Credit Union in the Account/Category field); $110.35.
-
2. A product is composed of subassembly S11 and part M23. Subassembly S11 is composed of subassembly S21 and part M24 and part M25. Subassembly S21 is composed of part M26, part M27 and part M25 All...
-
Will relationship selling continue to be part of the future of hospitality and tourism strategies? If so, how? If not, why? Discuss the 7 Steps of Selling (Prospecting & Qualifying; PreApproach;...
-
Required Information [The following Information applies to the questions displayed below] In each of the cases below, assume Division X has a product that can be sold to outside customers or to...
-
During the month of February, Riverbed Corp\'s employees earned wages of $ 8 6 0 0 0 . Withholdings related to these wages were $ 6 5 7 9 for FICA, $ 1 5 6 2 0 for federal income tax, and $ 4 1 8 0...
-
Cost of goods sold $395,000 Historical cost of ending inventory, as determined by a physical count 64,000 It is December 31, the end of current year, and the controller of Gravelle Corporation is...
-
Cheyenne Corporation issued 1 0 3 , 0 0 0 shares of $ 2 0 par value, cumulative, 8 % preferred stock on January 1 , 2 0 2 1 , $ 2 , 5 9 0 , 0 0 0 . In December 2 0 2 3 , Cheyenne declared its first...
-
Frank, who is an engineering student, thinks that his fellow engineering students are really a very diverse bunch of individuals. It appears that Frank views his in - group as being quite:
-
B.) What is the approximate concentration of free Zn 2+ ion at equilibrium when 1.0010 -2 mol zinc nitrate is added to 1.00 L of a solution that is 1.080 M in OH - . For [Zn(OH) 4 ] 2- , K f = 4.610...
-
Consider the following all-integer linear program: Max 10x1 + 3x2 s.t. 6x1 + 7x2 40 3x1 + 1x2 11 x1, x2 0 and integer a. Formulate and solve the LP Relaxation of the problem. Solve it graphically,...
-
Par, Inc., is a small manufacturer of golf equipment and supplies. Pars distributor believes a market exists for both a medium-priced golf bag, referred to as a standard model, and a high-priced golf...
-
Jackson Hole Manufacturing is a small manufacturer of plastic products used in the automotive and computer industries. One of its major contracts is with a large computer company and involves the...
-
IDEC Pharmaceuticals is considering a drug project that costs \($100,000\) today and is expected to generate end-of-year annual cash flow of \($50,000\) forever. At what discount rate would IDEC be...
-
Should you buy an asset that will generate income of \($1,200\) per year for eight years? The price of the asset is \($6,200\) and the annual interest rate is 10 percent.
-
In its most recent corporate report, Williams, Inc., apologized to its stockholders for not paying a dividend. The report states that management will pay a \($1\) dividend next year. That dividend...
Study smarter with the SolutionInn App