Question: ( CODE CONTINUED ) tempSnack = scnr . nextLine ( ) ; System.out.println ( Please Enter Snack Price: ) ; tempPrice = scnr
CODE CONTINUED
tempSnack scnrnextLine;
System.out.printlnPlease Enter Snack Price: ;
tempPrice scnrnextDouble;
if healthequalsIgnoreCasehealthy
snack newSnack new HealthySnacktempSnack tempPrice;
System.out.printlnnewSnack;
System.out.println;
else ifhealthequalsIgnoreCaseunhealthy
snack newSnack new UnhealthySnacktempSnack tempPrice;
System.out.printlnnewSnack;
System.out.println;
else
System.out.printlnPlease enter 'healthy' or 'unhealthy'";
public static void printSnack
System.out.printlnYour Snack List:";
selectedSnacks.forEachkey value System.out.printlnkey $ value;
public static void modifyList
String tempName;
double tempPrice;
Scanner scnr new ScannerSystemin;
System.out.printlnWhat snack would you like to remove?";
System.out.printlnPleae input a snack name from your list";
tempName scnrnextLine;
selectedSnacksforEachkey value selectedSnacks.equalstempName;
selectedSnacks.entrySetremoveIfentry entry.getKeyequalsIgnoreCasetempName;
public static void finalPrint
TODO Autogenerated method stub
Scanner scnr new ScannerSystemin;
String answer;
String secondAnswer;
while validInput
System.out.printlnWould you like to place or modify an order?";
System.out.printlnPlease answer with yes or no;
answer scnrnextLine;
secondInput false;
if answerequalsIgnoreCaseYES
validInput true;
while secondInput
System.out.printlnAre you placing a new order or modifying an existing order?";
System.out.printlnPlease answer with placing or modifying";
secondAnswer scnrnextLine;
try
if secondAnswerequalsIgnoreCasemodifying
secondInput true;
Code for modifying an existing list
System.out.printlnModifying an order with no prior orders will result in a default order.";
System.out.println;
System.out.printlnThis is your current list";
snack.baseList;
System.out.println;
receipt.howManyToModify;
SnackOrder.printSnack;
System.out.println;
validInput false;
else if secondAnswerequalsIgnoreCaseplacing
secondInput true;
Code for creating a new list
selectedSnacks.clear;
receipt.howManyToPurchase;
receipt.printDetails;
SnackOrder.printSnack;
receipt.sumTotal;
validInput false;
else
System.out.printlnPlease enter a valid input modifying or placing
;
secondInput false;
catch Exception e
System.out.printlnAn error occurred: egetMessage;
else if answerequalsIgnoreCaseNO
System.out.printlnThank you for using our service have a nice day!";
validInput true;
else
System.out.printlnplease enter a valid input
;
PLEASE MAKE A FLOWCHART FOR THIS JAVA CODE. THANK YOU
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
