I need help writing a program?

Write a program that will calculate the average miles per gallon for a salesperson. The salesperson leaves his home every Monday and returns every Friday. He travels by company car. Each day on the road, the salesperson records the amount of gasoline put in the car. Given the starting odometer reading (that is, the odometer reading before he leaves on Monday) and the ending odometer reading (the odometer reading after he returns home on Friday), the program will find the average miles per gallon. The output of the program should include 1. starting odometer reading, 2. ending odometer reading, 3. total mileages, 4. Gasoline purchased on Monday, 5. Gasoline purchased on Tuesday, 6. Gasoline purchased on Wednesday, 7. Gasoline purchased on Thursday, 8. Gasoline purchased on Friday, 9. Total Gasoline purchased, and 10. average miles per gallon. All output data should be aligned by the decimal points.

2009-09-29T11:45:25Z

A pseudo code would also help. Thanks

2009-09-30T05:15:09Z

Win 32 in C++

Cilegna2009-09-29T12:43:54Z

Favorite Answer

Hi,

I can help you with the general program flow (which can be applied to any language :) )

1) You need to get all the inputs required from the user
ie. Start meter reading, ending meter reading, Gas for Monday - Friday.

2) You have a few calculations to do, to get the output right
ie. Total Mileage(no 3) = End reading(no 2) - start reading(no 1)

Total Gas purchase (no 9) = Gas for Monday(no 4) + Tuesday(no 5) + Wednesday(no 6) + Thursday(no 7) + Friday(no 8).

Average Miles per gallon(no 10) = Total mileage(no 3) / Total gas(no 9)

3) Then you just need to output those calculations and the input back to the screen in the right order. (to get the output right, you will have to format the text or numbers to include the decimal points required - this varies from language to language)

Hope this helps!

Anonymous2016-12-25T00:57:46Z

1

delisa2016-04-29T08:47:18Z

If you have a challenge to helping your youngster that's trouble reading, no real matter what era she\he this system is what you need, Children Learning Reading from here https://tr.im/aP3S0 .
Children Learning Reading is distinctive from other applications because it does not rely on teaching words by sight, a way that relies on kiddies recognizing and memorizing words by their material and structure. You may have observed (or also obtained!) classes that promote full term acceptance understanding, these classes usually require you to stay your son or daughter in front of a tv or computer monitor for an important period of time so as in order for them to learn phrases that will let them to start their studying journey.
With Children Learning Reading your kid will just need to invest 5\15 minutes at day and he\she may learn to build the word making the complete process of understanding how to see much more effectively.

Shan2016-01-14T19:36:08Z

• A sales person leaves his home every Monday and returns every Friday. He travels by company car. Each day on the road the sales person records the amount of gasoline put into the car. Given the starting odometer reading (that is, the odometer reading before her leaves on Monday) and the ending odometer reading (the odometer reading after he returns on Friday), design an algorithm and computer program to find the average miles per gallon. (Take the gasoline unit as gallon)

Harley Drive2009-09-29T11:53:03Z

which language would you like it written in? do you want 16 bit, 32 bit or 64 bit? do you want it database compatible?

Show more answers (1)