Due: Monday, October 22
Goal: Introduction to Encapsulation
Start with your solution to the Beer program from Drill #10.
You have noticed a problem in usage. Some people are entering the alcohol percentage the wrong way. For example, if the alcohol percentage is 5% then some people are entering 5.0 instead of 0.05. As a result, the program tells people they will be legally intoxicated after a miniscule sip of beer.
Fix this problem by modifying the mutator method, setAlcohol. If the variable that is being set is over 1 then set the alcohol variable to the incoming value divided by 100. Otherwise set the alcohol variable to the incoming value. Test your program by setting the percent alcohol to 5.0 for Alaskan Amber in your main. The results should be unchanged.
After you have a working program and understand how it works, show the working code to your instructor or email it to email@example.com by the end of the day.