Question: .java 3 For credit, the program MUST include a sample run in a block comment below the last curly brace (below the program code). If

.java  .java 3 For credit, the program MUST include a sample run
in a block comment below the last curly brace (below the program
code). If this is not included, then the program is not complete.
The program could be resubmitted for late credit if turned in with
the sample run. A. Write the Java program to implement a menu:
Up to: Includes introductory Standard (**) block comment that includes: 2 Name
of project, description, Input, Computation, Output, And, name, and date in standard

3 For credit, the program MUST include a sample run in a block comment below the last curly brace (below the program code). If this is not included, then the program is not complete. The program could be resubmitted for late credit if turned in with the sample run. A. Write the Java program to implement a menu: Up to: Includes introductory Standard (**) block comment that includes: 2 Name of project, description, Input, Computation, Output, And, name, and date in standard format Successfully includes appropriate comments for each method of code Up to 3 Within a block comment above each method: (5 for each missing) Includes the name of the method and a short description Includes @param parameter Name : description for each parameter Includes @return varName: description for those methods that return a value Method: getPos Double(String prompt) Passes the prompt to this method Uses a while loop to ensure that only a positive (greater than zero) double value is returned back to the place where it was called AND USES THIS VALUE BACK IN MAIN Method: getPosInt(String prompt) 3 Passes the prompt to this method Uses a while loop to ensure that only a positive (greater than zero) integer value is returned back to the place where it was called AND USES THIS VALUE BACK IN MAIN Indentation is standard 2 IN MAIN: Program uses a while or do loop to loop until the exit choice is selected 2 IN MAIN: Program displays the menu and based on the selection made, performs that part of the switch statement Program computes results and calculates correctly. 3 Includes blank lines in both the program and output for readability 2 Z. Bahorski, 2021, COSC 111 2 Extra credit (1 point - Add a time stamp printed to the beginning of execution and to the end as shown.) Total points possible 22 CostPerLiter_CostPerGallon * This program converts liters to gallons and gallons to liters Declare variables (at the top of your program) Include the name of the program and your name as author Z. Bahorski, 2021, COSC 111 Deseribe the program to the user * Top of loop: (repeat until a 3 is entered by the user) Display the menu 1) 1/converts cost of gas purchased in liters to cost per gallon Acknowledge that a 1 has been entered Ask user for number of Liters purchased Ask user for cost of gas Convert Liters to Gallons Compute cost per gallon Print out the results 2) 1/converts cost of gas purchased in gallons to cost per liter) Acknowledge that a 2 has been entered Ask user for number of gallons purchased Ask user for cost of gas Convert from Gallons to Liters Compute cost per liter Print the results 3) Acknowledge that a 3 has been entered. State that the program will end * After the loop ends, thank the user for using your program (include your name here) * Formulas that you might need to use: SHOW that your methods * One gallon - 3.785411784 liters CAN handle negative * One liter = 0.26417205235815 gallons numbers (as shown in How many gallons is: 20 liters? + gallons = 20 * 0.26417205235814843 How many liters is 20 gallons? liters = 20 * 3.785411784 . * @author (Your name and Zenia Bohorski) * @version (15 February 2021) Cost Per Liter Cost Per Gallon > by Your Name This program will determine Cost per liter and Cost Per Gallons. Choose the conversion from the menu. Choose from the menu: 1: Cost per Gallon, based on number of Liters purchased 2: Cost per Liter, based on number of Gallons purchased 3: Quit the program Enter your choice: 1 1 has been entered Determining cost per Gallon... Enter number of Liters purchased: 10 Ente total cost of gas: 10 Ente I 10.0 liters at $10.0 costs 3.785411784 per gallon 10.00 litera at $ 10.00, costs $ 3.785 per gallon Choose from the menu: 1: Cost per Gallon, based on number of Liters purchased 2: Cost per Liter, based on number of Gallons purchased 3: Quit the program Enter your choice: 1 1 has been entered Determining cost per Gallon... Enter number of Liters purchased: 1 Enter total cost of gas: 1.50 1.0 liters at $1.5 costs 5.678117675999999 per gallon 1.00 liters at s 1.50, costs $ 5.678 per gallon Choose from the menu: 1: Cost per Gallon, based on number of Liters purchased 2: Cost per Liter, based on number of Gallons purchased 3: Quit the program Enter your choice: 1 1 has been entered Determining cost per Gallon... Enter number of Liters purchased: 1 Enter total cost of gas: 1.50 1.0 liters at $1.5 costs 5.678117675999999 per gallon 1.00 liters at $ 1.50, costs $ 5.678 per gallon Choose from the menu: 1: Cost per Gallon, based on number of Liters purchased 2: Cost per Liter, based on number of Gallons purchased 3: Quit the program Enter your choice: 2 2 has been entered Determine cost per Liter... Enter number of Gallons purchased: 10 Enter total cost of gas: 25.70 Igallons 10.0-gallons at $25.7 costs 0.6789221745604413 per liter 10.00 gallons at $ 25.70, costs $ 0.679 per liter Choose from the menu: 1: Cost per Gallon, based on number of Liters purchased 2: Cost per Liter, based on number of Gallons purchased 3: Quit the program For credit, the program MUST include a sample run in a block comment below the last curly brace (below the program code). If this is not included, then the program is not complete. The program could be resubmitted for late credit if turned in with the sample run. A. Write the Java program to implement a menu: Up to: Includes introductory Standard (***) block comment that includes: 2 Name of project, description, Input, Computation, Output, And, name, and date in standard format Successfully includes appropriate comments for each method of code Up to 3 Within a block comment above each method: (-5 for each missing) Includes the name of the method and a short description Includes @param parameterName : description for each parameter Includes @return varName : description for those methods that retum a value Method: getPos Double(String prompt) 3 Passes the prompt to this method Uses a while loop to ensure that only a positive (greater than zero) double value is returned back to the place where it was called AND USES THIS VALUE BACK IN MAIN Method: getPos Int(String prompt) Passes the prompt to this method Uses a while loop to ensure that only a positive (greater than zero) integer value is returned back to the place where it was called AND USES THIS VALUE BACK IN MAIN Indentation is standard 2 IN MAIN: Program uses a while or do loop to loop until the exit choice is selected 2 IN MAIN: Program displays the menu and based on the selection made, performs that part of the switch statement 2 Program computes results and calculates correctly. 3 Includes blank lines in both the program and output for readability * Describe the program to the user * Top of loop: (repeat until a 3 is entered by the user) Display the menu 1) 7/converts cost of gas purchased in liters to cost per gallon Acknowledge that a 1 has been entered Ask user for number of Liters purchased Ask user for cost of gas Convert Liters to Gallons Compute cost per gallon Print out the results 2) //Converts cost of gas purchased in gallons to cost per liter) Acknowledge that a 2 has been entered Ask user for number of gallons purchased Ask user for cost of gas Convert from Gallons to Liters Compute cost per liter Print the results 3) Acknowledge that a 3 has been entered. State that the program will end * After the loop ends, thank the user for using your * program (include your name here) * Formulas that you might need to use: * One gallon = 3.785411784 liters * One liter = 0.26417205235815 gallons SHOW that your methods CAN handle negative numbers (as shown in + * * How many gallons is: 20 liters? * gallons = 20 * 0.26417205235814843 * How many liters is 20 gallons? * liters = 20 * 3.785411784 * * @author (Your name and Zenia Bahorski) * @version (15 February 2021) Cost Per Liter Cost Per Gallon by Your Name This program will determine cost per Liter and Cost Per Gallons Choose the conversion from the menu. Choose from the menu: 1: Cost per Gallon, based on number of Liters purchased 2: Cost per Liter, based on number of Gallons purchased 3: Quit the program Enter your choice: 1 1 has been entered Determining cost per Gallon... Enter number of Liters purchased: 10 total cost of gas: 10 Ente 10.0 liters at $10.0 costs 3.785411784 per gallon 10.00 liters at $ 10.00, costs $ 3.785 per gallon Choose from the menu: 1: Cost per Gallon, based on number of Liters purchased 2: Cost per Liter, based on number of Gallons purchased 3: Quit the program Enter your choice: 1 1 has been entered Determining coat per Gallon... Enter number of Liters purchased: 1 Enter total cost of gas: 1.50 1.0 liters at $1.5 costs 5.678117675999999 per gallon 1.00 liters at $ 1.50, costs $ 5.678 per gallon Choose from the menu: 1: Cost per Gallon, based on number of liters purchased 2: Cost per Liter, based on number of Gallons purchased 3: Quit the program

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!