Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help with a programming project. Here are the instructions: (75 points) Program runs successfully (10 points) Inputs weight from the user using a

I need help with a programming project. Here are the instructions:

(75 points) Program runs successfully

(10 points) Inputs weight from the user using a Scanner object.

(5 points) Outputs all drink options in simple format

(10 points) Inputs drink choices from the user using a Scanner object

(5 points) Repeats until -1 is entered

(45 points) Outputs the final summary correctly

(25 points) Program contents follow readability standards including:

(15 points) Correct use of ArrayList lists

(10 points) Successfully complete simple and detailed format methods in Beverage class

Summary

We will create a detailed EBAC (Estimated Blood Alcohol Content) Tracker. Along with sobriety, we will also track calorie content and cost data to better help the user choose their drinks for the night. This data varies greatly based on the location, venue, and bartender, but very rough estimates are provided for the purpose of this project.

Details

Your program will need to start by asking the user for their weight to the nearest pound, then ask them to input each drink they have. These drinks are defined below, and you must use these items in the exactly the same order, though you can add items at the end of the list if desired. We will use standard values for the rest of the items required in the formula and assume that all drinks are consumed at the same time for simplicity. When the user enters -1 for their drink choice you will print a final summary that includes: 1) Every drink they had that night with its detailed summary (alcohol content, calories, and cost), 2) Their bill for the night 3) Their total calories consumed, 4) Their final EBAC, and 5) How long until they are complete sober again. Below is a sample run of the program, with the user input in green/bold/underlined format. To complete this project, you are required to use ArrayLists and the Beverage object that I provided for you. (This means you may NOT use primitive arrays.)

Note: When I test your projects, I will always enter valid data, but I will not enter the exact values from below. I will alter the weight, number of drinks, and drink selections to fully test your program.

Welcome to the EBAC Calculator!

Please enter your weight to the nearest pound:

150

Please enter the number of the item you would like to drink: (-1 to exit)

0) Bourbon and Water ($6.0)

1) Cosmopolitan ($7.0)

2) Gin and Tonic ($6.0)

3) Mojito ($6.0)

4) Margarita ($7.5)

5) Martini ($7.0)

6) Pina Colada ($6.0)

7) Screwdriver ($7.0)

8) Vodka and Tonic ($6.0)

9) Water ($0.0)

1

Please enter the number of the item you would like to drink: (-1 to exit)

0) Bourbon and Water ($6.0)

1) Cosmopolitan ($7.0)

2) Gin and Tonic ($6.0)

3) Mojito ($6.0)

4) Margarita ($7.5)

5) Martini ($7.0)

6) Pina Colada ($6.0)

7) Screwdriver ($7.0)

8) Vodka and Tonic ($6.0)

9) Water ($0.0)

2

Please enter the number of the item you would like to drink: (-1 to exit)

0) Bourbon and Water ($6.0)

1) Cosmopolitan ($7.0)

2) Gin and Tonic ($6.0)

3) Mojito ($6.0)

4) Margarita ($7.5)

5) Martini ($7.0)

6) Pina Colada ($6.0)

7) Screwdriver ($7.0)

8) Vodka and Tonic ($6.0)

9) Water ($0.0)

9

Please enter the number of the item you would like to drink: (-1 to exit)

0) Bourbon and Water ($6.0)

1) Cosmopolitan ($7.0)

2) Gin and Tonic ($6.0)

3) Mojito ($6.0)

4) Margarita ($7.5)

5) Martini ($7.0)

6) Pina Colada ($6.0)

7) Screwdriver ($7.0)

8) Vodka and Tonic ($6.0)

9) Water ($0.0)

4

Please enter the number of the item you would like to drink: (-1 to exit)

0) Bourbon and Water ($6.0)

1) Cosmopolitan ($7.0)

2) Gin and Tonic ($6.0)

3) Mojito ($6.0)

4) Margarita ($7.5)

5) Martini ($7.0)

6) Pina Colada ($6.0)

7) Screwdriver ($7.0)

8) Vodka and Tonic ($6.0)

9) Water ($0.0)

-1

Final Summary

You had the following drinks tonight:

Cosmopolitan 2.0 oz 212 cal $7.0

Gin and Tonic 2.0 oz 175 cal $6.0

Water 0.0 oz 0 cal $0.0

Margarita 2.5 oz 153 cal $7.5

Your bill for the night is: $20.5

You have consumed 540 calories.

Your final EBAC is 0.3181904761904762

It will be 6.5 hours until you are sober again

Good night!

Required Values

The formula for EBAC that we will use is: ouncesOfAlcohol * 5.14 / (weight * 0.7). Since we are using 1 ounce/hour as an estimate for alcohol processing, the ouncesOfAlcohol value is also the hours until the user is sober again.

Here are the drinks that you will need to use in your program, in this order. Notice that the first drink starts at 0. You may add additional drinks starting at index 10 if desired.

Index

Name

Ounces of Alcohol

Calories

Cost

0

Bourbon and Water

2

140

6.00

1

Cosmopolitan

2

212

7.00

2

Gin and Tonic

2

175

6.00

3

Mojito

2

242

6.00

4

Margarita

2.5

153

7.50

5

Martini

2.5

127

7.00

6

Pina Colada

3

440

6.00

7

Screwdriver

2

181

7.00

8

Vodka and Tonic

2

200

6.00

9

Water

0

0

0

Programming Strategy

As always, there are two big items to tackle in this project: Logic (how to hold all of this information in an ArrayList of Beverages) and Syntax (how to write all of the method calls, etc). It is very important that you think ahead to keep the logic clear, and then work each complex line of code methodically to get all of the syntax details in shape. Specifically: Remember that you will have an ArrayList of Beverage objects. When you use the get method on that ArrayList you will have an instance of a Beverage object, and from there you can make all of the necessary gets/sets/etc on the Beverage object.

Source Code Management

I strongly recommend the use of a Source Code Management product like git or svn that allows you to save your work periodically and then go back and look at the previous iterations. This allows you to go back if you break something and gives you confidence to improve already working code. Just be sure if you use an external site, like GitHub, that you create a private repository so others cannot view your code. Using an SCM will not give you any points for this assignment, but it may very well save you from getting a 0 if your program breaks at the last minute.

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_2

Step: 3

blur-text-image_3

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

More Books

Students also viewed these Databases questions

Question

Describe Table Structures in RDMSs.

Answered: 1 week ago