Problem

Define a Beer class that contains the following instance variables with accessors/ mutator...

Define a Beer class that contains the following instance variables with accessors/ mutators:

String name; // The name of the beerdouble alcohol; // The percent alcohol of the beer, e.g. 0.05 for 5%

Add the following method:

// This method returns the number of drinks that a person

// of (weight) pounds can drink using the alcohol percentage

// in the beer, assuming a drink of 12 ounces. This is an

// estimate. The method assumed that the legal limit is 0.08 blood

// alcohol.

public double intoxicated(double weight){      double numDrinks;      // This is a simplification of the Widmark formula numDrinks = (0.08 + 0.015) * weight / (12 * 7.5 * alcohol);	return numDrinks;}

Write code in a main method that creates two Beer objects with different alcohol percentages. Invoke the intoxicated method for a light individual and a heavy individual and output the estimated number of drinks to become legally intoxicated.

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT