The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 2 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
Extra Work
Happy Hour
Objective:
Write a class called Beer in which it follows this format:
Instance Variables
Name
Alcohol content. Beer is around 0.05 or 5%
MethodsAccessors and Mutators for the instance variables
Make sure in the mutator for the alcohol content contains a check to make sure the value is between 0 and 1 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 formula (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 enter in the names 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
Â