Question: Homework 5 Objective: Design the Coffee Hour Project and create Java classes as follows: Coffee this class represents a single cup of coffee with instance

Homework 5
Objective: Design the Coffee Hour Project and create Java classes as follows:
Coffee this class represents a single cup of coffee with instance variables and methods.
CoffeeTester this class create two instances of the Coffee class and tests the accessors, mutators and other methods work as intended.
Requirements:
Functionality (85 pts)
No Syntax, Major RunTime, or Major Logic Errors. (85 pts*)
*Code that cannot be compiled due to syntax errors is nonfunctional code and will receive no points for this entire section.
*Code that cannot be executed or tested due to major runtime or logic errors is nonfunctional code and will receive no points for this entire section.
Clear and EasyToUse Interface (5 pts)
Users should easily understand what the program does and how to use it.
Users should be prompted for input and should be able to enter data easily.
Users should be presented with output after major functions, operations, or
calculations.
All the above must apply for full credit
Create a class called Coffee with the following
Class Definition and Instance Variables (5 pts)
Name
A nonnull String that represents the name of the Coffee
Caffeine content in a single cup
Coffee contains around 50mg to 300mg of caffeine per cup
CSCE 145: Algorithmic Design I
A default constructor sets the instance variables to default values as follows: (5 pts)
Default Coffee Name : none
Default Caffeine Content: 50 mg Methods
Accessors for all instance variables (10 pts)
Create accessors for each instance variable
Returns the value of the current instance
Mutators for all instance variables (15 pts)
Create mutators for each instance variable
The mutator for the instance variable caffeine content is only allowed to accept a
value between 50 and 300(both inclusive)
RiskyAmount (10 pts)
Calculates the number of coffees before it would be dangerous to consume more within a short time frame, and it is based on this formula:
cups amount =180.0/((caffeine content /100.0)*6.0)
Returns the maximum number of coffee cups that can be consumed before it could become a health risk.
Equals (10 pts)
has a parameter of type Coffee
Returns true if this coffees instance matches with the other coffees instance
toString (10 pts)
Returns a String with the format
Name: <>
Caffeine Amount: <>
CSCE 145: Algorithmic Design I
Create a test class: CoffeeTester (15 pts)
This class contains a main method
Create 2 objects of the type Coffee
The user must be asked to enter the name and caffeine content of both coffees, and those
values must be assigned as long as they are valid.
The program must then print out the properties of each coffee (name and caffeine content) and print out the number of cups that if consumed within an hour would be a health risk.
The program must then determine if the two coffees have the same properties.
Finally, the user must be prompted to either stop the program or restart it.(See Example)
Coding Style (9 points) Readable Code
Meaningful identifiers for data and methods.
Proper indentation that clearly identifies statements within the body of a class, a
method, a branching statement, a loop statement, etc.
All the above must apply for full credit.
Comments (6 pts)
Your name at the beginning of the file as a singleline comment. (1 pt)
At least 5 meaningful comments in addition to your name. These must describe the
function of the code it is near. (5 pts)
Example:
Welcome to the Coffee Hour!!! Whats the name of the first coffee?
CSCE 145: Algorithmic Design I
Double Triple Loca Mocha Latte Venti Grande
Whats the caffeine content?
150
Coffee Name: Double Triple Loca Mocha Latte Venti Grande Caffeine Amount: 150
It would take 20.0 cups of Double Triple Loca Mocha Latte Venti Grande before its dangerous to drink more.
Whats the name of the second coffee?
Waffle House Coffee
Whats the caffeine content?
100
Coffee Name: Waffle House Coffee
Caffeine Amount: 100
It would take 30.0 cups of Waffle House Coffee before its dangerous to drink more. Are both coffees the same? False
Do you want to create more coffee objects? Enter Yes or No:
No
Submission:
Submit all .java files on Dropbox

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!