You will have 3 hours to complete the assignment. The assignment is actually 2.5 hours but 30 minutes have been added to cover potential problems, allow for uploading, and capturing a screenshot of the submission confirmation page.
Use the Scanner class to code this program
Filename: Lastname.java - replace "Lastname" with your actual last name. There will be a five (5) point deduction for an incorrect filename.
Submit only your source code file (this is the file with the ".java" extension - NOT the ".class" file).
You can only submit twice. The last submission will be graded.
This covers concepts in Chapters 2 - 5 only. The use of advanced code from other Chapters (including Chapter 4) will count as a major error.
Program Description
Follow the requirements below to write a program that will calculate the price of barbecue being sold at a fundraiser.
The program should perform the following tasks:
Display a menu of the types of barbecue available
Read in the user’s selection from the menu. Input Validation: The program should accept only a number between 1 and 3. If the user’s input is not valid, the program should force the user to reenter the number until they enter a valid input.
Ask the user to enter the number of pounds of barbecue being purchased. Input Validation: The program should not accept a number less than 0 for the number of pounds. If the user’s input is not valid, the program should force the user to reenter the number until they enter a valid input.
Output the total price of the purchase
Ask the user if they wish to process another purchase
If so, it should repeat the tasks above
If not, it should terminate
The program should include the following methods:
A method that displays a barbecue type menu. This method should accept no arguments and should not return a value. See the sample output for how the menu should look.
A method that accepts one argument: the menu selection. The method should return the price per pound of the barbecue. The price per pound can be calculated using the information below:
Barbecue Type Price per Pound
Chicken $9.49
Pork $11.49
Beef $13.49
A method that calculates the total price of the purchase. This method should accept two arguments: the price per pound and the number of pounds purchased. The method should return the total price of the purchase. The total price of the purchase is calculated as follows: Total Price = Price per Pound * Number of Pounds Purchased
A method that displays the total price of the purchase. The method should accept one argument: the total price.
All methods should be coded as instructed above. Modifying the methods (adding or removing parameters, changing return type, etc…) will count as a major error.
You should call the methods you created above from the main method.
The output of the program (including spacing and formatting) should match the Sample Input and Output shown below.
Sample Input and Output (include spacing as shown below).
Barbecue Type Menu:
1. Chicken
2. Pork
3. Beef
Select the type of barbecue from the list above: 1
Enter the number of pounds that was purchased: 3.5
The total price of the purchase is: $33.22
Do you wish to process another purchase (Y/N)? Y
Barbecue Type Menu:
1. Chicken
2. Pork
3. Beef
Select the type of barbecue from the list above: 3
Enter the number of pounds that was purchased: 2.5
The total price of the purchase is: $33.73
Do you wish to process another purchase (Y/N)? N