Question
Step 4: Create a MealDriver Class Finally, in the edu.umbc.is147.lab09 package, write a driver class called MealDriver which: Creates a new Menu object and calls
Step 4: Create a MealDriver Class
Finally, in the edu.umbc.is147.lab09 package, write a driver class called MealDriver which:
- Creates a new Menu object and calls menu.loadMenu(menuDataFilename).
- Creates 10 tickets where each ticket has (randomly) between 1 and 5 Meals on it.
- For each ticket, add the meals.
- Finally, generate the receipt by calling ticket.generateReceipt();
In order for MealDriver to access the Meal and Ticket classes, you will need to "import" those classes into MealDriver by placing import statements at the top of the MealDriver class file:
import edu.umbc.is147.lab01.menu.*;
import edu.umbc.is147.lab01.meal.Meal;
import edu.umbc.is147.lab01.ticket.Ticket;
Note 1: All classes should now be in their own .java files and in their designated packages.
Note 2: Compiling must be done from the "root" of the project, not the directory where the Java files exist. The "root" for my project is "D:\Root\UMBC\2020\IS147\Workspace\Lab09\src". See below:
Compiling:
PS D:\Root\UMBC\2020\IS147\Workspace\Lab09\src > javac -cp . edu/umbc/is147/spr2020/lab09/meal/Meal.java PS D:\Root\UMBC\2020\IS147\Workspace\Lab09\src > javac -cp . edu/umbc/is147/spr2020/lab09/menu/MenuItem.java PS D:\Root\UMBC\2020\IS147\Workspace\Lab09\src > javac -cp . edu/umbc/is147/spr2020/lab09/menu/Menu.java PS D:\Root\UMBC\2020\IS147\Workspace\Lab09\src > javac -cp . edu/umbc/is147/spr2020/lab09/MealDriver.java
Running: PS D:\Root\UMBC\2020\IS147\Workspace\Lab08\src> java -cp . edu.umbc.is147.spr2020.lab08.MealDriver Lab08MenuData.csv
Menu Loaded. ======================================= Date: Thu Apr 30 14:59:16 EDT 2020 --------------------------------------- Iced Coffee 2.19 Onion Rings 4.99 Fried Shrimp Platter 11.99 Cheesecake 4.99 --------------------------------------- Soft Drink 1.29 Cheeseburger Sliders 6.79 Bacon & Swiss Burger 9.39 1-Scoop Ice Cream 1.29 --------------------------------------- Subtotal: 42.92 Taxes: 2.15 Total: 45.07 =======================================
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