Question: I need the pseudo code this source code in Java public static void main(String[] args) { // Creating Scanner object Scanner keyboard = new Scanner(System.in);

I need the pseudo code this source code in Java

public static void main(String[] args) { // Creating Scanner object Scanner keyboard = new Scanner(System.in);

// empty char char character = '\0'; int menuOption; String name; int amount; int counter; // store number of person int numberOfPerson = 0; // set boolean boolean new_person;

// Store up to 10 change Change changeArray[] = new Change[10];

// create change object and store into array /* Change change1 = new Change("Sam", 65); changeArray[0] = change1; Change change2 = new Change("Brenda", 25); changeArray[1] = change2; Change change3 = new Change("Valarie", 55); changeArray[2] = change3; Change change4 = new Change("Caleb", 90); changeArray[3] = change4; Change change5 = new Change("Geoffrey", 15); changeArray[4] = change5; Change change6 = new Change("George", 60); changeArray[5] = change6; Change change7 = new Change("Evan", 70); changeArray[6] = change7; Change change8 = new Change("Alyssa", 35); changeArray[7] = change8; Change change9 = new Change("Doreen", 80); changeArray[8] = change9; Change change10 = new Change("Edward", 45); changeArray[9] = change10; */ Change information = new Change(); information.studentInfo(); // Recommendation message System.out.println(" Recommendation: Please enter at least 10 records to test the program.");

// loop till user key in n to exit do { new_person = true;

// prompt user to input customer name & coin amount System.out.print(" Please enter the name of the person: "); String oneWordName = keyboard.next(); name = oneWordName; keyboard.nextLine(); // name = keyboard.nextLine().trim(); System.out.print("Please enter coin value for the person (range 5 to 95, a multiple of 5): "); amount = keyboard.nextInt(); keyboard.nextLine();

// method to check if the input coin amount is valid if (amount < 5 || amount > 95 || (amount % 5) != 0) { System.out.println("Incorrect coin value. Must be in the range 5 to 95, multiple of 5"); continue; }

// looping to check if it is a returning customer for (counter = 0; counter < numberOfPerson; counter++) { if (changeArray[counter].getName().equalsIgnoreCase(name)) { // Update the total amount for the customer changeArray[counter].setAmount(changeArray[counter].getCoinChangeAmount() + amount); new_person = false; break; } }

// add new entry if the entered name has never been entered before if (new_person) changeArray[numberOfPerson++] = new Change(name, amount);

if (numberOfPerson >= 10) break;

System.out.print(" Do you have more person to enter (Y/N): "); character = Character.toUpperCase(keyboard.nextLine().trim().charAt(0)); } while (character != 'N');

// loop the choices till customer choose to end it do { // menu option selection message System.out.println(" 1. Enter a name and display change to be given for each denomination"); System.out.println( "2. Find the name with the smallest amount and display change to be given for each denomination"); System.out.println( "3. Find the name with the largest amount and display change to be given for each denomination"); System.out.println( "4. Calculate and display the largest number of coin denomination, and the total number of the coin"); System.out.println("5. Exit ");

// prompt customer to enter the choice System.out.print("Please enter your choice: "); menuOption = keyboard.nextInt(); keyboard.nextLine();

// call the method based on menu option select switch (menuOption) { // this case is to requesting customer to input name - display the customer name and the breakdown of // the denomination type of the coin amount case 1: displayChange(changeArray, numberOfPerson); break;

// this case to find and display the customer name and the breakdown of the denomination type of the // smallest coin amount case 2: displaySmallest(changeArray, numberOfPerson); break;

// this case to find and display the customer name and the breakdown of the denomination type of the // largest coin amount case 3: displayLargest(changeArray, numberOfPerson); break;

// this case to find and display the breakdown of the most counts for the denomination type and sum the // total count case 4: displayTotal(changeArray, numberOfPerson); break;

// this case is display a farewell message and exit the program case 5: System.out.println(" Thank you for using the program."); System.exit(0); break;

// this default case will display when customer entered an option that is not listed from the above default: System.out.println("Invalid choice! Please enter again."); } } while (menuOption != 5); } }

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!