Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

IN JAVA PLEASEEEEEEE!!!!!!!! Objective: Write a class called Beer with the following Instance Variables Name Alcohol content. Beer is around 0.05 or 5% MethodsAccessors and

IN JAVA PLEASEEEEEEE!!!!!!!!

Objective:

Write a class called Beer with the following

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 a test 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:

Lets Party! Responsibly...

Whats the name of the first beer?

Pabst Blue Hipster

Whats the alcoholic content?

0.05

Whats the name of the second beer?

Moo Brew

Whats the alcoholic content?

0.08

Whats 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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions