Question: Java Programming Assignment Arrays and Functions Create a project called MPG. Rufus, a junior computer programmer, is fanatical about his new GMC Pickup Truck and
Java Programming Assignment
Arrays and Functions
Create a project called MPG.
Rufus, a junior computer programmer, is fanatical about his new GMC Pickup Truck and wants to keep track of the Miles, Gallons and MPG of his truck. To do this, he wants to write a simple program that will allow him to enter the Miles driven and Gallons of gas used each week and will calculate the MPG for each week as well as his Total Average MPG and display the results. Since the dog ate his homework, his car wont start, he has to work and he is sick, hes asked you to write the program for him.
- Declare the arrays
- Prompt and get the size of the arrays (how many weeks) and then create the arrays
- Prompt and get the values for the Miles array.
- Prompt and get the values for the Gallons array.
- Calculate the values for the MPG Array.
- Display the three arrays in this manner.
Miles Gallons MPG ------ -------- --------- Week 1 240.5 10.3 23.3 Week 2 300.0 15.6 19.2 Total 540.5 25.9 20.8
Hand in: A listing of your source program A hard copy of the output using the following data
Miles Gallons ------ ---------- Week 1 240.5 10.3 Week 2 300.0 15.6 Week 3 255.0 12.2 Week 4 288.0 14.2 Week 5 150.0 8.0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
