Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

We are going to build the first stage of what will become the final project. The idea is to create a bar menu manager application

We are going to build the first stage of what will become the final project. The idea is to create a bar menu manager application allowing you to manage a bars daily menu. For this first stage, we are going to build and test some basic classes that we will need in the next stages.

Create an Eclipse project named [your pitt id]_MenuManager

Create a package edu.pitt.is17.[your pitt id].menumanager

Implement the following classes as represented in the class diagrams. Methods and constructors are explained below.

Classes Appetizer, Entree, Side and Beer are all similar, representing the parts of a menu.

Appetizer

Entree

-name:String

-name:String

-description: String

-description: String

-calories:int

-calories:int

+Appetizer(name: String, desc:String, cal:int)

+Entree(name: String, desc:String, cal:int)

Side

Beer

-name:String

-name:String

-description: String

-description: String

-calories:int

-calories:int

+Side(name: String, desc:String, cal:int)

+Beer(name: String, desc:String, cal:int)

Class Menu contains one object of each of the previously defined classes (Appetizer, Entree, Side and Beer) and a name.

Menu

-name: String

-appetizer:Appetizer

-entree :Entree

-side: Side

-beer:Beer

+Menu(name: String)

+Menu(name:String, entree:Entree, side:Side)

+Menu(name:String, entree:Entree, side:Side, appetizer:Appetizer, beer:Beer)

+totalCalories() : int

+description(): String

Methods in class Menu:

totalCalories(): sums the calories of all the parts of the menu (Beer, Appetizer, Entree and Side)

description() : concatenates the descriptions of the parts of the menu in order. First Appetizer, then Entree, then Side and lastly, Beer. It has to separate the descriptions by new lines and add the type and the name of each part of the menu. A menu could lack some of the parts, in this case, it has to indicate as N/A. For example:

Appetizer: Nachos. Literally three pounds of chips cheese and meat.

Entree: Pizza Margherita. The best kind of pizza.

Side: N/A

Beer: Augustiner. Get some gemtlichkeit today!

TIP: you can check if an object is null :

if(side == null) { something here! }

There are 3 constructors in class Menu setting some of the parts of the menu. All of them need the name of the menu (the name is always required). All parts that are not passed in the constructors should be set to null. For example, the first constructor Menu(String name) sets the name and then sets all other fields to null:

appetizer = null;

entree = null;

side = null;

beer = null;

Add getters and setters for all fields in all classes. Getters and setters are not included in the diagram and they are assumed.

Create a class MenuTest with a main method to test the Menu class. Create, for example, 2 entrees, 1 appetizer, 2 side and 1 beer and 2 Menu objects. Then fill the first menu with an entree and a side. Fill the second menu with the remaining: 1 entree, 1 side, 1 appetizer and 1 beer. Print out both menus, including the menu name, the total amount of calories and the description. Note that this is only to test the classes, so just make sure you try all the functionalities of Menu and other classes here.

Add comments to your classes. Add a comment just above the class definition (top of the file, but after imports and package lines) including your name (author) and date when created (created). Look at this example showing the JavaDoc format:

/**

* Class Entree

* author : Bill

* created: 02/10/2017

*/

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

C++ Database Development

Authors: Al Stevens

1st Edition

1558283579, 978-1558283572

Students also viewed these Databases questions

Question

Understand corporate and HRM strategy.

Answered: 1 week ago

Question

=+5 Does this case provide an example of the future for IHRM?

Answered: 1 week ago

Question

=+4 How did it affect HR?

Answered: 1 week ago