![]() |
| |||||||
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 (permalink) |
| Senior Member Join Date: Mar 2008
Posts: 103
Reputation: -24 ![]() | Write a program that calculates mileage reimbursement for a salesperson at a rate of $.35 per mile. Your program should interact with a user in this manner: MILEAGE REIMBURSEMENT CALCULATOR Enter beginning odometer reading=> 13505.2 Enter ending odometer reading=>13810.6 You traveled 305.4 miles. At $.35 per mile, your reimbursement is $106.89. I need help with writing a program for this problem. I know its a pretty simple problem but i'm just starting out so if someone could write this and send me the code it would help me out a lot on getting started with the rest of my assignment. Remember it has to be wrote in C. |
| | |
| | #3 (permalink) |
| Senior Member Join Date: Jun 2008
Posts: 546
Reputation: 54 ![]() | Don't really think anyone is going to write this for you with -17 rep and your name, and the fact you aren't offering a exchange prize for the work that is being done.
__________________ Talk show host: Have you ever stolen anything? Connie (Asian): [quickly] YES!!! Maury: Connie! Wait you gotta build the suspense, that is how Fox turns 5 minutes of material into an hour long program. -MADtv |
| | |
| | #4 (permalink) |
| Senior Member Join Date: Mar 2008
Posts: 103
Reputation: -24 ![]() | #include <stdio.h> #define REIMBURSE_PER_MILE 0.35 int main(void) { double begmiles; double endmiles, reimbursement; /* Get the beginning amount of miles*/ printf("Enter beginning odometer reading=>"); scanf("%lf", &begmiles); /*Get the ending ammount of miles*/ printf("Enter ending odometer reading=>"); scanf("%lf", &endmiles); /*Tell How many miles traveled*/ scanf("endmiles+-begmiles"); printf("You traveled (endmiles+-begmiles) miles."); return(0); } That is what i have written so far, what happens is it asks me for beginning miles and i enter it then it asks for ending miles and i enter it then it quits. I think i'm having trouble with naming the variables. |
| | |
| | #5 (permalink) |
| Senior Member Join Date: Dec 2007
Posts: 660
Reputation: 18 ![]() | This is on C++ int main () { double a, b,c; cout <<"MILEAGE REIMBURSEMENT CALCULATOR"<<endl; cout <<"Enter beginning odometer reading" cin >>a cout <<endl<<"Enter ending odometer reading"; cin>>b c=b-c; cout <<"You traveled<< c << "miles"; cout <<"You traveled<< c <<"miles." << " At $.35 per mile, your reimbursement is << c*.35; return 0; } |
| | |
| | #11 (permalink) |
| Senior Member Join Date: May 2008
Posts: 514
Reputation: 12 ![]() | that's because it runs out of lines of code all you have to do is 1. set up variable for the difference in miles 2. print the difference 3. multiply the difference by the reimbursment mount and store it 4. print that variable and you're done |
| | |
| | #13 (permalink) |
| Senior Member Join Date: Mar 2008
Posts: 103
Reputation: -24 ![]() | ok thanks, i did that and it doesn't pause the program when it the next step comes up and i can't remember how to make it pause and wait for a button to be pressed, is it pause char? #include <stdio.h> #define REIMBURSE_PER_MILE 0.35 int main(void) { double begmiles; double endmiles, reimbursement; /* Get the beginning amount of miles*/ printf("Enter beginning odometer reading=>"); scanf("%lf", &begmiles); /*Get the ending ammount of miles*/ printf("Enter ending odometer reading=>"); scanf("%lf", &endmiles); /*Tell How many miles traveled*/ scanf("endmiles-begmiles"); printf("the difference is %d", (endmiles - begmiles)); /*Multiply the difference by the rate*/ printf("%d*REIMBURSE_PER_MILE"); return(0); } That is what i have and i'm stuck i know it is way wrong but i have no idea what to do. Last edited by bigfatturd; 08-31-2008 at 04:14 PM. |
| | |
![]() |
| Tags |
| hw, programming |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Stuck on ahk need some help for some simple programming | shemer77 | Bot Makers | 5 | 08-11-2008 06:29 PM |
| Web Programming question | Seatbelt99 | Other / Unlisted Networks | 11 | 04-04-2008 07:03 AM |
| Programming Session. | impuLsivE | Announcements | 5 | 01-27-2008 02:53 PM |
| Who is decent with programming? | snowboardbum | Chit Chat | 3 | 01-11-2008 04:35 PM |
| Anyone have experience programming motor controlers? | ahage16 | Chit Chat | 1 | 12-23-2007 03:55 PM |