Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Compute it in Java! The list of prices is given below: A1 Bruschetta 5.29 A2 Caprese_Flatbread 6.10 A3 Artichoke-Spinach_Dip 3.99 A4 Lasagna_Fritta 4.99 A5 Mozzarella_Fonduta

Compute it in Java!

image text in transcribedThe list of prices is given below:

A1 Bruschetta 5.29 A2 Caprese_Flatbread 6.10 A3 Artichoke-Spinach_Dip 3.99 A4 Lasagna_Fritta 4.99 A5 Mozzarella_Fonduta 5.99 E1 Lasagna_Classico 6.99 E2 Capellini_Pomodoro 7.99 E3 Eggplant_Parmigiana 8.99 E4 Fettuccine_Alfredo 7.49 E5 Tour_of_Italy 14.99 D1 Tiramisu 2.99 D2 Zeppoli 2.49 D3 Dolcini 3.49 S1 Soda 1.99 S2 Bella_Limonata 0.99 S3 Berry_Acqua_Fresca 2.88

The initial code is also given:

import java.util.Scanner; import java.io.*; public class Restaurant { public static void main(String[] args) { // TODO Auto-generated method stub Scanner input = new Scanner(System.in); System.out.println("Enter your order:"); String line = input.nextLine(); System.out.println(line); Scanner orderInput = new Scanner(line); //split the line to individual codes... while (orderInput.hasNext()) System.out.println(orderInput.next()); } }

Please continue from here

Load the menu for a restaurant from the data file restaurant.txt (it has the code, product name & price in each line). Then, simulate the order taking process - keep getting the order string & generate well-formatted receipt in an infinte loop - use Store10a.java that we covered in the class for guidance & use Restaurant.java as the start-up file. You should create at least 3 minimum methods. Review the sample input & output to understand the expectations (this goes along with the sample data file I have provided). Your program should be generic - it should work for any menu contents and any order string. Attach your updated Restaurant.java and complete this assignment. No need to attach anything else. Enter your order: A1 A2 E1 E2 Bruschetta Caprese Flatbread 6.10 Lasagna Classico Capellini Pomodoro 7.99 5.29 6.99 Total XX.YY Enter your order: A1 E3 S1 Bruschetta Eggplant Parmigiana 8.99 Soda 5.29 1.99 Total XX.YY Enter your order: A1 E3 S1 E10 Bruschetta Eggplant Parmigiana 8.99 Soda E10 is invalid! 5.29 1.99 Total XX.YY

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_step_2

Step: 3

blur-text-image_step3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Genetic Databases

Authors: Martin J. Bishop

1st Edition

ISBN: 0121016250, 978-0121016258

More Books

Students also viewed these Databases questions

Question

Q: Is your system characteristic of the Israeli workplace?

Answered: 1 week ago

Question

3. Is there opportunity to improve current circumstances? How so?

Answered: 1 week ago

Question

2. How will you handle the situation?

Answered: 1 week ago