Question: Please solve this in Dr.Java Thank you! Objective: Write a class called Coffee with the following Instance Variables Name Caffeine content. Coffee is around 50

Please solve this in Dr.Java

Thank you!

Objective:

Write a class called Coffee with the following

  • Instance Variables
    • Name
    • Caffeine content. Coffee is around 50 to 300mg of caffeine
  • Methods
    • Accessors and Mutators for the instance variables
      • Make sure in the mutator for the caffeine content contains a check to make sure the value is between 50 and 300 inclusively
    • RiskyAmount
      • 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 number of coffees it would take before they could be at a health risk.

Next write a test class

  • Contains a main method
  • Creates two instances of the type Coffee
  • Have the user enter in the names and caffeine contents for both
  • Print out the results

Example Output:

Lets Coffee!!!1!11!!ONE!!!1!

Whats the name of the first coffee?

Double Triple Loca Mocha Latte Venti Grande

Whats the caffeine content?

150

Whats the name of the second coffee?

Waffle House Coffee

Whats the caffeine content?

100

It would take 20.0 Double Triple Loca Mocha Latte Venti Grande coffees before its dangerous to drink more.

It would take 30.0 Waffle House Coffee coffees to before its dangerous to drink more.

Later Tater

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 Databases Questions!