Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Database Administrator Limited Edition

Authors: Martif Way

1st Edition

B0CGG89N8Z

More Books

Students also viewed these Databases questions

Question

11 Recruitment strategies.

Answered: 1 week ago

Question

Describe Table Structures in RDMSs.

Answered: 1 week ago