JAVA PROGRAMMING-LMS INTEG.MINDTAP
JAVA PROGRAMMING-LMS INTEG.MINDTAP
8th Edition
ISBN: 9781337091503
Author: FARRELL
Publisher: Cengage Learning
bartleby

Videos

Question
Book Icon
Chapter 5, Problem 5GZ
Program Plan Intro

Rock Paper Scissors game

Program plan:

  • Import necessary package.
  • Create a class “RockPaperScissors”,
    • Define the method “main()”,
    • Declare and initialize the necessary variables.
    • Generate the random value for the computer.
    • Assign the integer value returned from the method “parseInt()”.
    • Check whether the user value is “1”,
      • If it is true set the string as “rock”.
    • Otherwise, check whether the user value is “2”,
      • If it is true set the string as “paper”.
    • Otherwise,
      • Set the string as “scissors”.
    • Check whether the computer value is “1”,
      • If it is true set the string as “rock”.
    • Otherwise, check whether the computer value is “2”,
      • If it is true set the string as “paper”.
    • Otherwise,
      • Set the string as “scissors”.
    • Check whether the user value is “1”,
      • Check whether the computer value is “1”,
        • If it is true, set the string as “tie”.
          • Otherwise, check whether the computer value is “2”,
            • If it is true, set the string as “computer”.
          • Otherwise, set the string as “you”.
    • Check whether the user value is “2”,
      • Check whether the computer value is “2”,
        • If it is true, set the string as “tie”.
          • Otherwise, check whether the computer value is “3”,
            • If it is true, set the string as “computer”.
          • Otherwise, set the string as “you”.
    • Otherwise, check whether the computer value is “3”,
      • If it is true, set the string as “tie”.
    • Otherwise, check whether the computer value is “1”,
      • If it is true, set the string as “computer”.
    • Otherwise, set the string as “you”.
    • Display the output message in dialog box.

Blurred answer
Students have asked these similar questions
When the given integer variable numberOfPackages is: greater than 12, output "Needs more than one box". between 5 inclusive and 12 inclusive, output "Large box". between 0 exclusive and 4 inclusive, output "Small box". less than or equal to 0, output "Invalid input". End with a newline.
summarize in a short paragraph how to Advance Incident Response and Automation in ML home based security systems
1.[30 pts] Computers generate color pictures on a video screen or liquid crystal display by mixing three different colors of light: red, green, and blue. Imagine a simple scheme, with three different lights, each of which can be turned on or off, projecting onto a glass screen: We can create eight different colors based on the absence (0) or presence (1) of light sources R,G and B: R G B Color 0 0 0 Black 0 0 1 Blue 0 1 0 Green 0 1 1 Cyan 1 0 0 Red 1 0 1 Magenta 1 1 1 0 Yellow 1 White 1 Each of these colors can be represented as a bit vector of length 3, and we can apply Boolean operations to them. a. The complement of a color is formed by turning off the lights that are on and turning on the lights that are off. What would be the complement of each of the eight colors listed above? b. Describe the effect of applying Boolean operations on the following colors: Λ 1. Red(100) ^ Magenta(101)= Blue(001) 2. Bue(001) | Green(010)= 3. Yellow(100) & Cyan(011)= 2.[30 pts] Perform the following…
Knowledge Booster
Background pattern image
Computer Science
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
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:9780357392676
Author:FREUND, Steven
Publisher:CENGAGE L
Text book image
Operations Research : Applications and Algorithms
Computer Science
ISBN:9780534380588
Author:Wayne L. Winston
Publisher:Brooks Cole
Java random numbers; Author: Bro code;https://www.youtube.com/watch?v=VMZLPl16P5c;License: Standard YouTube License, CC-BY