Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
Write a Java program that allows user to play Rock, Paper and Scissors game with a computer based on the exercise we did in class (which is posted on Moodle). You can refer to Powerpoint Slide #46 to use integers 0, 1, and 2 to represent rock, paper and scissors.
At the beginning your program displays a welcome message "Welcome to Rock, Paper and Scissors game with my Computer", it then asks the user to enter his/her choice (only one of the choices: rock, paper and scissors is allowed). You can use a do... while loop to check the validity of the user input. Then your program use a random number generator to pick rock, or paper or scissors for the computer and displays computer’s pick. After that your program displays the result (either you win, or lose or a draw). After one game, your program asks user if he/she wants to continue. If the user decides to stop playing, your program displays how many games you played and how many time you win, lose and tie, and displays a "Thank you for playing" message.
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 4 steps with 3 images
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
- In JAVA, Write a program to find the sum of all numbers divisible by 5 in the range 1 to 100.arrow_forwardStarting Out with Java From Control Structures through Objects 6th Edition Paint Job Estimatorarrow_forwardIn java write a complete Java program that displays all the numbers, from 1 to 200, that are divisible by both 2 and 3. Numbers are separated by exactly one space.arrow_forward
- Write a program in java that completes the following prompt: You are a fundraising distributor who needs to to pre-sell a limited number of doughnut coupon books. Each buyer can buy as many as 4 coupon books. No more than 100 coupon books can be sold. Implement a program called Fundraiser that prompts the user for the desired number of coupon books and then displays the number of remaining coupon books. Repeat until all coupon books have been sold, and then display the total number of buyers.arrow_forwardJAVA PROGRAMarrow_forwardI have been working on writing a java program (that goes with another I just got finished- see below CollegeCourse & Student) that prompts user to put in letter grades (A-F) for 5 different courses for a total of 10 different students. So I need to prompt user to input a student ID, then the 1st course ID, then the grade, then the 2nd course ID- then grade, the the 3rd course ID then grade, then the 4th course ID then grade, then finally the 5th course ID then grade. Then it needs to go through the same thing 10 times (for a total of 10 students). It also says the user is asked to "Enter ID for student #s" where s is an integer from 1 through 10, indicating the student (and I don't really know how to do that but I tried as I googled java); AND "Enter course ID #n, where n is an integer from 1 through 5, indicating the course number. And last it needs to verify for grade entry that only the A, B, C, D, or F are entered.I started writing notes to try to keep track of where thing are…arrow_forward
- Create a Java program that can be used to calculate the average weekly and monthly grocery bill for a family of four: Prompt the user for the coupon amount as a decimal (example, .10). Ensure the value is set to 10% if the value exceeds 100% or is less than or equal to zero. Prompt the user for 2-4 weeks of grocery bills. Calculate the monthly and weekly average for groceries. Display monthly total and weekly average without the coupon. Display monthly total and weekly average with the coupon.arrow_forwardwrite a program in Java that would ask the clerk to enter the total amount of the customer’s order. The program will then calculate a seven percent (7%) sales tax. Commission is computed based on the following: order amount id="mce_marker" - $200 commission is 2%, order amount $201 - $400 commission is 3%, order amount $401 - $600 commission is 4%, order amount > $600 commission is 5%, The program will display the following: a) The amount of customer’s order (eg. $500.00 or id="mce_marker",000.00) b) The tax amount c) The total amount including tax added d) Commission Amount e) The customer will make ten orders, display the average of the total order and the sum of all orders. You must use at least two methods. Write the output to a file named “Order.txt” The program should also display “Thanks for your business and please come again.”arrow_forwardIn Java 8, I want the program to capture the current year and compare it to an input value. Specifically, the user is asked to enter the last two digits of a year that will be output. If those two digits are greater than the last two digits of the current year, the program will print to console a “19” before the two digits the user inputted. If the two digits that the use input are less than or equal to the last two digits of the current year, the program will print to the console a “20” before the two digits the user inputted. For instance, if the current year is 2023, and the user input the integer number “74”, the program would output to the console “1974”. If the current year is 2023, and the user input the integer number “19”, the program would output to the console “2019”. The user is not asked to enter the current year; the program captures that automatically. The user only enter the last two numbers of a year. Hopefully, that's enough to go by and clear enough. I need the code,…arrow_forward
- Write a program (use value returning method) that gives simple math quizzes. The program should display two random integers from 1 to 100 that are to be added,The program allows the user to enter the answer. If the answer is correct, display “congratulations”. If the answer is incorrect, the program should show the correct answer. using java programmingarrow_forwardJava Programming: The program will figure out a number chosen by a user. Ask user to think of a number from 1 to 100. The program will make guesses and the user will tell the program to guess higher (h) or lower (l). Sample run of the program might look like below : Guess a number from 1 to 100. (here, the user is thinking of 81) Is it 50? (h/l/c): h Is it 75? (h/l/c): h Is it 88? (h/l/c): l Is it 81? (h/l/c): c Great! Do you want to play again? (y/n): y Guess a number from 1 to 100. (here the user is thinking 37) Is it 50? (h/l/c): l Is it 25? (h/l/c): h Is it 37? (h/l/c): c Great! Do you want to play again? (y/n): n our program should implement the binary search algorithm. Every time the program makes a guess it should guess the midpoint of the remaining possible values. Consider the first example above, in which the user has chosen the number 81: On the first guess, the possible values are 1 to 100. The midpoint is 50. The user responds by saying “higher” On the second…arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education