Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help writing this program in Java, any help is greatly appriciated :) You will be writing software to support Toms Diner. Toms Diner

I need help writing this program in Java, any help is greatly appriciated :)

You will be writing software to support Toms Diner. Toms Diner has the following menu:

Drinks:

Coffee 99 cents

Small soda (12 oz) 99 cents

Large soda (18 oz) $1.50

Side dishes

Salad $1.99

Green Beans $1.99

Rice $1.99

Entrees

8 oz Steak 99 cents an ounce

12 oz Steak 99 cents an ounce

16 oz Steak $1.20 an ounce

Chicken Breast $3.99 each

Desserts

Cake $1.99 a piece

Ice Cream by the scoop 99 cents per scoop

Sundae (Ice cream by the scoop + toppings)

All items for sale at the diner will implement the Restaurant interface

The getPrice() method returns the cost of an item in cents, as an integer

The setPrice(int) method sets the cost of an item in cents, as an integer

The getName() methods returns the name of the item

The Item Class : Represents a basic menu item with no options, such as a side dish or a drink like a cup of coffee

Properties

price an int to hold the cost of the item in cents

name A String to hold the name of the item

Methods

Item(String, int) : overloaded constructor

Accessors and Mutators : Add logic to ensure name isnt blank, and price is a number > 0

toString() : Return a String representation of the item

The SizeableItem Class (inherits from the Item class)

This is used to create customizable items like an 8 ounce steak, 12 ounce steak, or a 1 scoop or 2 scoop ice cream, or a drink (12 oz Soda, 16 oz Soda, or 24 oz Soda, etc.). In the case of the constructor, the price will be the price per item (price per ounce of steak, or price per scoop of ice cream). The parent setPrice(int) method will need to be called to update the price based on the quantity * pricePerQuantity. For instance, creating a sizeable item for an 8 oz. steak that costs 99 cents per ounce would be done like this:

SizeableItem eightOzSteak = new SizeableItem(8 oz. Steak, 99, 8);

In the constructor, the code would need to call the parent constructor with the name and the pricePerQuantity * the quantity, and set the quantity.

Properties

quantity : an integer to represent how many or what size of the item the customer wants

Methods

SizeableItem(String, int, int) : overloaded constructor

Accessors and Mutators : Add logic to ensure quantity is a number > 0

The SizeableToppingsItem Class (inherits from the SizeableItem class)

This is used to create customizable SizeableItem with extra toppings, such as a scoop of Ice Cream or a Sundae (or perhaps a Steak with peppers and onions). In the case of the constructor, the parameters are all the same as the parent class. After the object is created, toppings can be added through the addToppings method. Each topping added will update the price by adding

the TOPPING_COST to the price. Toppings can be removed through the removeToppings method. Any toppings removed will have the TOPPING_COST removed from the price.

Properties

TOPPING_COST : a constant integer to represent how much a single topping costs. Set to 50 cents

toppings : an ArrayList of toppings that have been added to this item. The ArrayList holds values from the Topping enumeration (see diagram).

Methods

SizeableToppingsItem(String, int, int)

getToppings() : return the ArrayList of toppings added to this item

addTopping(Topping) : Add a Topping from the Topping enum to the toppings ArrayList and update the price

removeTopping(Topping) : Remove a Topping from the toppings ArrayList and update the price

The Order class

This is the driver of your application. Your application should initialize all variables necessary, and loop at least once, asking the user to add items from the menu to their order, and customize any items as necessary (add toppings to a Sundae, for instance).

Once the customer has completed the order, the application should calculate the total, then calculate the taxes. The Tax amounts should be rounded to the nearest cent (For example, calculating the tax on

a food item with a cost of 199 cents at a rate of 3% should return 6 cents use Math.round()). Calculate the total after taxes, print out the receipt for the order, the total due for the order before and after taxes, and collect payment. Once payment is collected, the change should be returned, the order cleared, and the next customer should be able to start a new order, unless the user chooses to exit.

All money should be displayed in the correct format of $##.## (example: $22.18). See the UML diagram for suggested static methods in addition to main.

For a small bonus, suggest a 15% tip, an 18% tip, or a custom tip, and give the user the option of tipping the server.

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: 3

blur-text-image

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

DB2 11 The Database For Big Data And Analytics

Authors: Cristian Molaro, Surekha Parekh, Terry Purcell, Julian Stuhler

1st Edition

1583473858, 978-1583473856

More Books

Students also viewed these Databases questions

Question

1. Explain the 2nd world war. 2. Who is the father of history?

Answered: 1 week ago

Question

=+you think is being taxed when more money is printed? Why?

Answered: 1 week ago