Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I ' m having trouble trying to solve these errors within my code. String name = scanner.nextLine ( ) ; System.out.println ( Please enter
Im having trouble trying to solve these errors within my code. String name scanner.nextLine;
System.out.printlnPlease enter the price for name ;
double price scanner.nextDouble;
scanner.nextLine; Consume nevline leftover
System.out.printlnPlease enter the base yogurt flavor for name ;
String base scanner.nextLine;
ArrayList
This is my Menu.java code that I have so far.
Everytime I go to run the code, I receive this error shown below.
sre mein menu FrozenYogurt.jevepublic class FrozenYogurt extends MenuItem private String toppings; supername price; this.toppings toppings;public String getBase return toppings;public void addToppingString topping newToppingstoppingslength topping;public String toString "Price : $ getPrice
"Topping : String.join toppings
;
Annotated Matches View of matches found
Matches are uppercased and indicated with before and after the match
Welcome to the Menu
Actions:
Add a salad
Add a sandwich
Add a frozen yogurt
Display an item
Display all items
Add a topping to an item
Quit
Please CHOOSE from the above actions: Please enter the name of the frozen YOGURT:
Please enter the PRICE for Berry Delight:
Please enter the BASE yogurt flavor for Berry Delight:
Please enter a TOPPING for Berry Delight enter 'done' to finish:
Please enter a topping for Berry Delight enter 'done' to finish:
Please enter a topping for Berry Delight enter 'done' to finish:
Please enter a topping for Berry Delight enter 'done' to finish:
Please enter a topping for Berry Delight enter 'done' to finish:
Please enter a topping for Berry Delight enter 'done' to finish:
Please enter a topping for Berry Delight enter 'done' to finish:
Please enter a topping for Berry Delight enter 'done' to finish:
Please enter a topping for Berry Delight enter 'done' to finish:
Exception in thread "main" java.util.NoSuchElementException: No line found
at java.util.Scanner.nextLineScannerjava:
Missing: another topping
Missing: additional
Missing: another topping
Missing: additional
Missing: another topping
Missing: choose
Missing: Displaying
at Menu.addFrozenYogurtMenujava:
at Menu.mainMenujava:
Missing: Berry Delight
Missing:
Missing: vanilla
Missing: blueberries, blackberries, strawberries
Missing: choose
Missing: Thank
The codes I've used are all shown below.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started