Programming (COM 204)
You have been requested by car manufacturer to develop a program that satisfies the following requirements. Read the following instructions very carefully.
FIRST: Design your program using either flowcharts or pseudo code. Be sure to include all the part of the design we have discussed in class, i.e. outline what variable you will use in terms of data type and valid variable name, outline the flow of the program and indicate whether each step is an input, processing, or output. Finally, be sure to comment your design so the reader understands exactly what you are trying to do. Use can use any program you want to do this, Word, Powerpoint, etc.
SECOND: Code your design. Using jGrasp, create a program that implements your design. This MUST be done in jGrasp and saved as a .java file. The requirements for the program are provided below.
Be able to handle 4 different car models
Enter the Model Name of each of the cars
Enter the miles per gallons (MPG) for each of the cars
Enter the size of the gas tank in gallons for each of the cars
Calculate the Endurance Value for each of the cars
Formula 1: Endurance Value = Gallons * MPG
f. Calculate the Average Endurance Value.
Formula 2: SUM of all endurance values from paragraph (e) / (the number of cars)
g. Determine which cars have an endurance greater than 300 miles
h. Display the following: The car Model Name, Gallons, MPG, Endurance
i. Display the Average Endurance value from paragraph (g).
j. Display the Name of the car and the endurance of the cars that meet the criteria in g.
Note: The output of the program is up to you. The test case below is merely to provide a way to check to see if your program is working.
The following is a test case to see whether or not your program is working.
Model Name Gallons MPG Endurance
Ford 12 20 240
Chevy 10 18 180
Toyota 16 30 480
Lexus 11 25 275
Average Endurance for these cars is 257.5 miles.
Toyota exceeds a 300 mile endurance with 480 miles.