Write a Java program to help a convenience store clerk decide whether or not to sell beer to a customer. Beer can only be sold to somebody who is 21 years old or more and has enough money (beer costs...


Write a Java program to help a convenience store clerk decide whether or not to sell<br>beer to a customer. Beer can only be sold to somebody who is 21 years old or more<br>and has enough money (beer costs $5.00). If the customer is too young, tell them how<br>many years they must wait before returning. If they have too little money, tell them<br>how much more is needed.<br>program will require the use of nested

Extracted text: Write a Java program to help a convenience store clerk decide whether or not to sell beer to a customer. Beer can only be sold to somebody who is 21 years old or more and has enough money (beer costs $5.00). If the customer is too young, tell them how many years they must wait before returning. If they have too little money, tell them how much more is needed. program will require the use of nested "if/else" statements. Examine the sample outputs carefully in order to structure your code in a logical manner. Work out your logic in pseudo code first. Test carefully to ensure that your logic works exactly as it should. This ** BONUS** 5 bonus points if you use printf successfully to print out the dollar amount needed when the customer does not have enough money. Notes: Carefully read and adhere to coding standards – pay particular attention to the use of braces and indentation Use CONSTANTS for the beer price and minimum age Choose meaningful identifiers for all variables and constants Use blank lines here and there to separate logical steps in your code Add comments to document your code. Comments are not optional and must be included. o Use a one-line comment before each block to describe what you are doing – don't describe the code syntax, but rather the purpose of the code. These comments should effectively describe the steps in your "algorithm." Spell things carefully, including capitalization, since Java is fussy about that Check your results! Testing your code is IMPORTANT! Here is a sample run of the program: Please type customer age: 25 Type customer cash amount: 3.25 Sorry, you need $1.75 more. Here is yet another sample run: Thank you for your patronage. Please type customer age: 102 Here is another sample run: Please type customer age: 9 Type customer cash amount: 6.75 Congratulations, you can have some No beer for you! beer. Come back in 12 years. Thank you for your patronage. Thank you for your patronage.
Jun 08, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here