Question

In: Computer Science

Write a C++ program that calculates mileage reimbursement for a salesperson at a rate of $...

Write a C++ program that calculates mileage reimbursement for a salesperson at a rate of $ 0.35 per mile. Your program should interact with the user in this manner:

MILEAGE REIMBURSEMENT CALCULATOR

Enter beginning odometer reading: 13505.2

Enter ending odometer reading     : 13810.6

You traveled 305.40 miles.

At $ 0.35 per mile, your reimbursement is $ 106.89.

The values in red color are inputs for the program.

The values in blue color are results of expressions.

Solutions

Expert Solution

Source_code:

#include <iostream>    //Header file
using namespace std;           //This tells the compiler to use std namespace library
int main()                   //Main function
{
   float miles, odometer1, odometer2, reimbursement, rate;               //variables declaration
   printf("MILEAGE REIMBURSEMENT CALCULATOR.\n");                       //printf function
   printf("Enter the beginning odometer reading:>");
   scanf("%f", &odometer1);
   printf("\nEnter the ending odometer reading:>");
   scanf("%f", &odometer2);
   miles = odometer2 - odometer1;
   printf("\nSalesperson traveled %6.2f", miles);
   rate = 0.35;
   reimbursement = miles * rate;                                   //reimbursement calculation
   printf("\nTotal owed reimbursement is $%6.2f", reimbursement);

   getchar();
   return 0; //to pause the final output
}   

Source_code_images:

Output:

MILEAGE REIMBURSEMENT CALCULATOR.
Enter the beginning odometer reading:>13505.2

Enter the ending odometer reading:>13810.6

Salesperson traveled 305.40
Total owed reimbursement is $106.89

Output_images:


Related Solutions

***Please answer the question using the JAVA programming language. Write a program that calculates mileage reimbursement...
***Please answer the question using the JAVA programming language. Write a program that calculates mileage reimbursement for a salesperson at a rate of $0.35 per mile. Your program should interact (ask the user to enter the data) with the 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 $0.35 per mile, your reimbursement is $106.89. ** Extra credit 6 points: Format the answer (2 points),...
C program help 1. Write a program to compute the Mileage given by a vehicle. Mileage...
C program help 1. Write a program to compute the Mileage given by a vehicle. Mileage = (new_odometer – old_odometer)/(gallons_gas) // illustrating how ‘for’ loop works. 2. How to initialize an array of size 5 using an initializer list and to compute it’s sum How to initialize an array of size 5 with even numbers starting from 2 using ‘for’ loop and to compute it’s sum 3. Program to compute the car insurance premium for a person based on their...
Write a C program that calculates a worker’s wages from their hours worked and hourly rate....
Write a C program that calculates a worker’s wages from their hours worked and hourly rate. This wage calculator should also account for overtime hours, calculate amount to be witheld from taxes, and calculate the final net income. Required functionality: 1. Ask the user for the number of hours worked and hourly rate in dollars. The program should be able to accept decimal values for both of these (e.g. 3.2 hours, 11.25 dollars/hour) 2. Overtime hours are those worked in...
Your task is to write a program in C or C++ that calculates the total amount...
Your task is to write a program in C or C++ that calculates the total amount of money a person has made over the last year. Your program will prompt the user for dollar amounts showing how much the user has made per job. Some users will have had more than one job, make sure your program allows for this. The program will print out the total made (all jobs) and will print out the federal and state taxes based...
Write a C program that calculates a student grade in the C Programming Class. Ask the...
Write a C program that calculates a student grade in the C Programming Class. Ask the user to enter the grades for each one of the assignments completed in class: Quiz #1 - 25 points Quiz #2 - 50 points Quiz #3 - 30 points Project #1 - 100 points Project #2 - 100 points Final Test - 100 points The total of the quizzes count for a 30% of the total grade, the total of the projects counts for...
In C++, Write a program that calculates pay for either an hourly paid worker or a...
In C++, Write a program that calculates pay for either an hourly paid worker or a salaried worker. Hourly paid workers are paid their hourly pay rate times the number of hours worked. Salaried workers are paid their regular salary plus any bonus they may have earned. The program should declare two structures for the following data: Hourly Paid: HoursWorked HourlyRate Salaried: Salary Bonus The program should also declare a union with two members. Each member should be a structure...
IN JAVA Write a program that calculates the occupancy rate for each floor of a hotel....
IN JAVA Write a program that calculates the occupancy rate for each floor of a hotel. (Use a sentinel value and please point out the sentinel in bold.) The program should start by asking for the number of floors in the hotel. A loop should then iterate once for each floor. During each iteration, the loop should ask the user for the number of rooms on the floor and the number of them that are occupied. After all the iterations,...
Write a program that calculates the occupancy rate for each floor of a hotel. (Use a...
Write a program that calculates the occupancy rate for each floor of a hotel. (Use a sentinel value and please point out the sentinel in bold.) The program should start by asking for the number of floors in the hotel. A loop should then iterate once for each floor. During each iteration, the loop should ask the user for the number of rooms on the floor and the number of them that are occupied. After all the iterations, the program...
USING C++ PLEASE Write a program named Lab11C that calculates the average of a group of...
USING C++ PLEASE Write a program named Lab11C that calculates the average of a group of test scores where the lowest score is dropped. It should use the following functions a) void getScores should have 4 double reference parameters (one for each test score) getScores should do the following: - read 4 test scores from the text file Lab11C.txt (Important: declare your ifstream infile and open the file inside this function, not in the main function) - store them in...
Write a program that calculates the compound interest for an investment. (C++ coding language) If you...
Write a program that calculates the compound interest for an investment. (C++ coding language) If you deposit an amount of money P , the principal, at an interest rate r then the interest will compound over time. This means that the interest earned each period becomes part of the principal and the next time you get interest you earn interest on the interest. This is known as compounding. The equation for compound interest is ( r)n·t Pn=P0 1+n where P0...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT