Write a class called beer in which it given this format-


Write a class called Beer in which it follows this format:

• Instance Variables

. Name
. Alcohol content. Beer is around 0.05 or 5%

• Methodes
. Amason and Mutators the instance variables

• Make sore in the mutator. for the alcohol content contains a check to make sure the value is between 0 and I exclusively.

. Intoxicated

• Takes in a parameter of type double corresponding to weight

• Calculates the number of drinks required to make a person intoxicated based on this fomlula (0.08 0.015) x. Weight / (12 x 7.5 x Alcohol)

 • Returns the number of beers it would take before they are .Intoxicated

Next write another class

       • Contains a main method
       • Creates two instances of the type Beer
       • Have the user enters in the name and alcohol contents for both
       • Next enter in a weight value and it calculates how many drinks it would take for a person at that weight to become intoxicated

       • Print out the results

Example Output

Let's Party! Responsibly...
What's the name of the first beer?
Pabst Blue Hipster
What's the alcoholic content?
0.05
What's the name of the second beer?
Moo Brew
What's the alcoholic content?
0.08
What's the weight of the person consuming said beverages? 150
It would take 3.166 Pabst Blue Hipster beers to become intoxicated. It would take 1.979 Moo Brew beers to become intoxicated.
Later Tater

Solution Preview :

Prepared by a verified Expert
Data Structure & Algorithms: Write a class called beer in which it given this format-
Reference No:- TGS01186973

Now Priced at $40 (50% Discount)

Recommended (91%)

Rated (4.3/5)

A

Anonymous user

4/12/2016 9:00:55 AM

In this assignment, you have to write a class called Beer in which it obeys the following format: 1) Instance Variables: a) Name b) Alcohol content. Beer is approximately 0.05 or 5% 2) Methodes: a) Amason and Mutators the instance variables 3) Make sore in the mutator for the alcohol content includes a check to ensure the value is between 0 and I completely. a) Intoxicated 4) Takes in a parameter of kind double corresponding to the weight 5) Computes the number of drinks needed to make a person intoxicated based on this formula (0.08 0.015) x. Weight / (12 x 7.5 x Alcohol) 6) Returns the number of beers it would take prior to they are Intoxicated.