The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
How can I revise it? to make it right?
Please only an expert!
Â
This is sample output=========================================Game 1:Choose your weapon? rI chose the weapon: PYou lose!Game 2:Choose your weapon? sI chose the weapon: PYou win!Game 3:Choose your weapon? pI chose the weapon: SYou lose!Do you want to play again? nThis is my code.====================================================import java.util.*;public class Step {public static void main(String[] args) {//call the method introduction();//call the method playManyGamesScanner console=new Scanner(System.in);introduction();playManyGames(console);}public static int getGames(Scanner console){//this method asks the player number of times he/she is//going to play//save the result in the variable called games and//return the result to the calling methodSystem.out.println("What is your name?");String name=console.next();System.out.println();System.out.println("Best out of how many games do you want to play "+name+"?");int games=console.nextInt();while(games%2==0){System.out.println("Invalid number of games. Type a positive odd number!");games=console.nextInt();}return games;}public static void playManyGames(Scanner console) {/*this method actually plays the game. In this method youwill call the method called getGames and playGame. getGamesmethod returns the number of times that player wants toplay and this will be your loop control variable. In thismethod you need to keep track of how many times the
Attachments: