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
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 pts
No Syntax, Major RunTime or Major Logic Errors. 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 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 pts
Name
A nonnull String that represents the name of the Coffee
Caffeine content in a single cup
Coffee contains around mg to mg of caffeine per cup
CSCE : Algorithmic Design I
A default constructor sets the instance variables to default values as follows: pts
Default Coffee Name : none
Default Caffeine Content: mg Methods
Accessors for all instance variables pts
Create accessors for each instance variable
Returns the value of the current instance
Mutators for all instance variables pts
Create mutators for each instance variable
The mutator for the instance variable caffeine content is only allowed to accept a
value between and both inclusive
RiskyAmount 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 caffeine content
Returns the maximum number of coffee cups that can be consumed before it could become a health risk.
Equals pts
has a parameter of type Coffee
Returns true if this coffees instance matches with the other coffees instance
toString pts
Returns a String with the format
Name:
Caffeine Amount:
CSCE : Algorithmic Design I
Create a test class: CoffeeTester pts
This class contains a main method
Create 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 itSee Example
Coding Style 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 pts
Your name at the beginning of the file as a singleline comment. pt
At least meaningful comments in addition to your name. These must describe the
function of the code it is near. pts
Example:
Welcome to the Coffee Hour!!! Whats the name of the first coffee?
CSCE : Algorithmic Design I
Double Triple Loca Mocha Latte Venti Grande
Whats the caffeine content?
Coffee Name: Double Triple Loca Mocha Latte Venti Grande Caffeine Amount:
It would take 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?
Coffee Name: Waffle House Coffee
Caffeine Amount:
It would take 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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
