Order Now  +1 678 648 4277 

Implement a simple console application for tracking ice-cream orders in Java assignment help

The assignment requires the implementation of a simple Java console application. The solution contains two parts as explained by our Java assignment helpers:- the first part is a logic Java class, which needs to implement necessary API methods. The other part is the implementation of the console menu, which allows users to deal with ice-cream orders via created logic class. User is allowed to create, update, list orders and see statistics of orders for the current day.

Ice-cream Order Tracker Simulation

Driver.java import java.util.Scanner; public class Driver { private static final Scanner scanner = new Scanner(System.in); private static int todaysSundaesNum; private static Sundae[] todaysSundaes; public static void main(String[] args) { System.out.println("Welcome!"); System.out.print("How many sundaes could you make today? "); // Reading sundaes number todaysSundaesNum = Integer.parseInt(scanner.nextLine().trim()); todaysSundaes = new Sundae[todaysSundaesNum]; // Run main menu showMenu(); scanner.close(); } private static void showMenu() { while (true) { try { // Showing main menu message System.out.println("What do you want to do?"); System.out.println("\t1. Enter a new sundae order"); System.out.println("\t2. Change information of a specific order"); System.out.println("\t3. Display details for all sundaes of a specific ice cream flavor"); System.out.println("\t4. Statistics on today's sundaes"); System.out.println("\t5. Quit"); System.out.print("Please, enter your choice "); // Parsing reponse int respond = Integer.parseInt(scanner.nextLine().trim()); switch (respond) { case 1: if (todaysSundaesNum<= Sundae.getCreatedNumber()) { System.out.println("Sorry, we don't have enough ingredients to male another sundae"); } else { // Asking details of new Sundae SundaenewSundae = askSundaeDetails(); todaysSundaes[Sundae.getCreatedNumber() - 1] = newSundae; } break; case 2: if (Sundae.getCreatedNumber() == 0) { System.out.println("Sorry, we don't have any sundaes so far"); } else { // ASking modifying details modifySundaeDetails(); } break; case 3: // Showing flavors dialog showFlavor(); break; case 4: // Showing information menu showInfo(); break; case 5: // Exiting application System.out.println("Good Bye!"); return; default: throw new IllegalArgumentException(); } } catch (Exception e) { System.out.println("Invalid choice. Please, try one more time"); } } } private static Sundae askSundaeDetails() { int scoops; String flavor; booleannuts; while (true) { try { System.out.print("\tHow many scoops of ice cream? "); scoops = Integer.parseInt(scanner.nextLine().trim()); if (scoops <= 0) { // Scoops number must be positive throw new IllegalArgumentException(); } break; } catch (Exception e) { System.out.println("Invalid input. Please, try one more time"); } } while (true) { try { System.out.print("\tWhat flavor? "); flavor = scanner.nextLine().trim(); if (flavor.isEmpty()) { // Flavor name must not be empty throw new IllegalArgumentException(); } break; } catch (Exception e) { System.out.println("Invalid input. Please, try one more time"); } } while (true) { try { System.out.print("\tAny nuts? (y for yes anything else for no) "); nuts = "y".equals(scanner.nextLine().trim().toLowerCase()); break; } catch (Exception e) { System.out.println("Invalid input. Please, try one more time"); } } return new Sundae(flavor, scoops, nuts); } private static void modifySundaeDetails() { System.out.println("\t--> Valid sundae numbers are 0 to " + (Sundae.getCreatedNumber() - 1)); int sundaeN; while (true) { try { System.out.println("\t--> Valid sundae numbers are 0 to " + (Sundae.getCreatedNumber() - 1)); System.out.print("Which sundae do you wish to modify? "); sundaeN = Integer.parseInt(scanner.nextLine().trim()); if ((sundaeN<0) || (sundaeN>= Sundae.getCreatedNumber())) { // sundaeN must be in a given range throw new IllegalArgumentException(); } break; } catch (Exception e) { System.out.println("Sorry, no such sundae. Please, try one more time"); System.out.print("Do you want to enter another sunday number or return to the main menu (quit to return anything else to enter) "); // Asking if user wants to quit if ("quit".equals(scanner.nextLine().trim().toLowerCase())) { return ; } } } while (true) { // Showing modify a menu System.out.println("What would you like to change?"); System.out.println("\t1. Ice cream flavor"); System.out.println("\t2. Number of scoops"); System.out.println("\t3. nuts or no nuts"); System.out.println("\t4. Quit"); System.out.print("Enter choice "); int respond = Integer.parseInt(scanner.nextLine().trim()); switch (respond) { case 1: // Modifying ice cream flavor System.out.print("New flavor: "); todaysSundaes[sundaeN].setFlavor(scanner.nextLine().trim()); todaysSundaes[sundaeN].updateCost(); System.out.println("Here is what the sundae looks like now"); System.out.println("\t" + todaysSundaes[sundaeN].toString()); break; case 2: // Modifying scoops number System.out.print("How many scoops? "); todaysSundaes[sundaeN].setNumberOfScoops(Integer.parseInt(scanner.nextLine().trim())); todaysSundaes[sundaeN].updateCost(); System.out.println("Here is what the sundae looks like now"); System.out.println("\t" + todaysSundaes[sundaeN].toString()); break; case 3: // Modifying nuts if (todaysSundaes[sundaeN].isNuts()) { todaysSundaes[sundaeN].setNuts(false); todaysSundaes[sundaeN].updateCost(); System.out.println("Nuts removed from this sundae"); } else { todaysSundaes[sundaeN].setNuts(true); todaysSundaes[sundaeN].updateCost(); System.out.println("Nuts added to this sundae"); } System.out.println("Here is what the sundae looks like now"); System.out.println("\t" + todaysSundaes[sundaeN].toString()); break; default: return; } } } private static void showFlavor() { System.out.print("What flavor do you want a list of? "); // Reading flavor to show String flavor = scanner.nextLine().trim(); booleanfound = false; // Iterating overall made sundaes to find ones with given flavor for (int i = 0; i6)) { throw new IllegalArgumentException(); } switch (respond) { case 1: System.out.println("List all sundaes sold today"); for (int i = 0; i