Question: import java.util.Random; public class Main { public static void main ( String [ ] args ) { Random rand = new Random ( ) ;

import java.util.Random;
public class Main {
public static void main(String[] args){
Random rand = new Random();
System.out.print("Enter player 1 name: ");
String player1name = System.console().readLine();
System.out.print("Enter player 1 max steps: ");
int player1maxsteps = Integer.parseInt(System.console().readLine());
System.out.print("Enter player 2 name: ");
String player2name = System.console().readLine();
System.out.print("Enter player 2 max steps: ");
int player2maxsteps = Integer.parseInt(System.console().readLine());
System.out.print("Do you want to play a regular 30 step game or a different number of steps? (30/different)");
String choice = System.console().readLine();
if (choice.equals("30")){
PlayGame(player1name, player1maxsteps, player2name, player2maxsteps);
} else {
System.out.print("Enter the number of steps to cross the finish line: ");
int finishLine = Integer.parseInt(System.console().readLine());
PlayGame(player1name, player1maxsteps, player2name, player2maxsteps, finishLine);
}
}
public static void PlayGame(String player1name, int player1maxsteps,
String player2name
The class name in the OverLoad should be Overload as Java's source file name should be exact same as its first public class. You should have the 4-parameter method and 5-parameter method PlayGame define inside the class Overload.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!