Jump to content

Can someone do this quick/easy program for me?

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
4 replies to this topic

#1
clearsights

clearsights

    Newbie

  • Members
  • Pip
  • 1 posts
Ok this is all I need to do....

Write a program to ask the user for odometer readings before and after and gallons of gas used for each of three trips. Calculate the distance and miles per gallon for each trip. Display that information in a report like:


Trip Report
Trip Start End Distance Gallons MPG
1 10078.9 10172.6 93.7 4.65 20.0
2 10364.0 10687.5 323.5 14.90 21.7
3 11538.3 11647.8 109.5 5.34 20.5

If someone could write that for me id be very grateful

#2
Steve.L

Steve.L

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 444 posts
I'm not going to pump out code for you, else you'd be learning absolutely nothing from us. ;)

All you have to do is created a function:

float milesPerGallon(float miles, float gallons) {
    // ... Your code here.
    return yourVar;
}

Then just call that function from your main() function, making sure to include your parameters. It's fairly simple, you should get it really quick. If you can't, do a bit of reading around the web, or come back after you've at least tried to code it, and show us what you've got.

Edited by Steve.L, 24 September 2008 - 06:49 AM.


#3
morefood2001

morefood2001

    Speaks fluent binary

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,720 posts
Codecall members will not do your homework for you! The only way to learn how to program is to actually program. Codecall is a community where you can come if you have specific problems that you can't figure out.

I will be happy to help you with specific errors when you post your code :)

#4
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
What part of the assignment are you having issues with?
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#5
Guest_Jordan_*

Guest_Jordan_*
  • Guests
Why would you not want to learn how to do it yourself? Future homework is only going to get harder and build from this.