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.

  1. Declare the arrays
  2. Prompt and get the size of the arrays (how many weeks) and then create the arrays
  3. Prompt and get the values for the Miles array.
  4. Prompt and get the values for the Gallons array.
  5. Calculate the values for the MPG Array.
  6. 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

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!