Java program Assignment Description: Checkpoints You must use arrays(or arraylis
ID: 3825166 • Letter: J
Question
Java program
Assignment Description: Checkpoints
You must use arrays(or arraylist) for this exercise
Write a program that does the following:
• (1 Point) Provide the following “menu” (choices) to the user:
o Enter Checkpoints o Edit Checkpoints
o Display Checkpoints
o Exit program
• Ask the user to choose from the menu
o (2 Points) Continue to show the menu (even with invalid choice – give error message but don’t exit) until the user chooses “Exit program.”
• For “Enter Checkpoints”:
o (1 Point) Ask the user for data to store for the given checkpoint
(1 Point) Keep track of how many checkpoints has been entered and tell the user what # checkpoint they are to enter.
(1 Point) Store data for each checkpoint in an appropriate array.
o Ask the user if the user would like to enter more checkpoints
(1 Point) Allow the user to keep entering data until the user says otherwise
o (1 Point) Return to the menu when the user is done entering trip data
• For “Edit Checkpoints”:
o (1 Point) Ask the user for which checkpoint to edit (tell the user how many checkpoints are available)
(1 Point) Show the user the data for the checkpoint to edit and ask the user for a replacement data.
o Ask the user if the user would like to edit more checkpoints
(1 Point) Allow the user to keep editing data until the user says otherwise
o (1 Point) Return to the menu when the user is done editing checkpoints
• For “Display Checkpoints”
o (2 Points) Display every data for each checkpoint
o (1 Point) Return to the menu after displaying data for each checkpoint
Explanation / Answer
PFB the wireframe:
class Menu
{
List<Integer> checkpoints=new ArrayList<Integer>();
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
int choice;
do{
System.out.println(" ---MENU----");
System.out.println("1. Enter Checkpoints");
System.out.println("2. Edit Checkpoints");
System.out.println("3. Display checkpioints");
System.out.println("4. Exit program");
System.out.println("Choose option...1,2,3,4");
choice =in.nextInt();
if(choice==1)// code here
if(choice==2)// code here
if(choice==3) // code here
} while(choice!=4);
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.