EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
8th Edition
ISBN: 9781305480537
Author: FARRELL
Publisher: CENGAGE LEARNING - CONSIGNMENT
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
I would like to know about the following concepts: 1. defragmentation 2. disk management 3. hardware RAID
Node.js, Express, and Nunjucks Templates?
CIT244 Program Project 3 Assignment As with any assigned program, do not wait until the last minute to start. Start early in the week the program is due so you can ask questions if you get stuck Node.js and Express and Nunjucks Templates We have gotten to the good stuff. There is a program similar to this assignment given as the last example in the lecture notes for the week that discusses node static files. This program will take more time that previous assignments. There are several examples you should study first, particularly the pizza order example program available in the examples programs folder for the week discussing static files. You should study and run the pizza order program before trying this program. The pseudo-company is called Sun or Fun, which offers cheap flights from Louisville to either Miami or Vegas. Here's a video of how it should work. NOTE: You will hear or see references to Handlebars in this video. We used to use Handlebars, but it will be Nunjucks that we…
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