MINDTAPV2.0 JAVA PROGRAMMING 2021, 1TERM
9th Edition
ISBN: 9780357505526
Author: FARRELL
Publisher: CENGAGE L
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter 7, Problem 2GZ
Program Plan Intro
Enhancement of Rock Paper Scissors game
Program plan:
- Import necessary packages.
- Create a class “RockPaperScissors2”,
- Define the “main()” method.
- Declare a variable.
- Declare and initialize variables.
- Execute the following,
- Create “Scanner” object.
- Generate Random number.
- Prompt the user to enter Rock or Paper or Scissor.
- Increment the number of games.
- Get the user input.
- Take the first two characters of user input.
- Convert it into upper case.
- Execute switch statement,
- If the random number is “3”.
- Print a message.
- Check if first two characters of user input is "PA", print a message, and increment the number of loses.
- Else,
-
- Check if first two characters of user input is "SC", print a message, and increment the number of ties.
- Else,
-
- Check if first two characters of user input is "RO", print a message, and increment the number of wins.
- If the random number is “1”,
- Print a message.
- Check if first two characters of user input is "SC", print a message, and increment the number of loses.
- Else,
-
- Check if first two characters of user input is "RO", print a message, and increment the number of ties.
- Else,
-
- Check if first two characters of user input is "PA", print a message, and increment the number of wins.
- If the random number is “2”,
- Print a message.
- Check if first two characters of user input is "SC", print a message, and increment the number of wins.
- Else,
-
- Check if first two characters of user input is "RO", print a message, and increment the number of loses.
- Else,
-
- Check if first two characters of user input is "PA", print a message, and increment the number of ties.
- For a default case, print a message as “Invalid input.”.
- Ask the user if they want to repeat or not,
- Get the opinion.
- Check the condition in exit “while” loop.
- Print total number games.
- Print total number wins.
- Print total number loses.
- Print total number ties.
- Define the “main()” method.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Using R language
Using R language
Using R language
Chapter 7 Solutions
MINDTAPV2.0 JAVA PROGRAMMING 2021, 1TERM
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- After our initial deployment for our ML home based security system, the first steps we took to contribute further to the project, we conducted load testing, tested and optimize for low latency, and automated user onboarding. What should be next?arrow_forwardWhy investing in skills and technology is a critical factor in the financial management aspect of system projects.arrow_forwardwhy investing in skills and technology is a critical factor in the financial management aspect of systems projects.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,
- Programming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage LearningEBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTNp Ms Office 365/Excel 2016 I NtermedComputer ScienceISBN:9781337508841Author:CareyPublisher:Cengage
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:9781337508841
Author:Carey
Publisher:Cengage
Expressions in C++ | C++ tutorial for beginners; Author: Tutorial Mart;https://www.youtube.com/watch?v=XHbsZGpmRc8;License: Standard YouTube License, CC-BY
expression in python # python expressions; Author: Abhishek Tripathi;https://www.youtube.com/watch?v=Cc-kJGRjH6k;License: Standard Youtube License