Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a computer program as a Win32 console application in C to calculate two re

ID: 3781737 • Letter: W

Question

Write a computer program as a Win32 console application in C to calculate two reimbursement for a salesperson at a rate of $0.50 per mile. Your program shall take two numbers as inputs, and then display the mileage and reimbursement amount The name of your source file shall be p1 .c and that of your executable program shall be p1.exe. You program shall receive information from the user as the user types in two numbers to be processed. Your program shall NOT print information to the screen except as required herein. Your one-time output program heading and prompt shall be MILEAGE REIMBURSEMENT CALCULATOR Enter beginning odometer reading = 13503.2 Enter ending odometer reading = 13810.6 (The underlined numbers .0 the right, simulate user-entered numbers that are not part of the prompt itself) Your program shall accept two floating point numbers on two separate lines for a given calculation. The two numbers shall be of double data type. For a given pair of numbers, the printout shall be of the form You travelled 307.4 miles. At $0.50 per mile, your reimbursement is $153.70. (The numbers above are examples only. Replace them with what you calculate and be sure to follow each line of output with a newline.) Your output should be formatted exactly as the examples above.

Explanation / Answer

#include <stdio.h>
void main()
{
        float beginingOdometer;
        float endingOdometer;
        printf("MILEAGE REIMBURSEMENT CALCULATOR ");
        printf("Enter beginning odometer reading=> ");
        scanf("%f", &beginingOdometer);
        while(getchar() != ' ');
        printf("Enter ending odometer reading=> ");
        scanf("%f", &endingOdometer);
        while(getchar() != ' ');
        float miles;
        miles = endingOdometer - beginingOdometer;
        float reimbursement;
        float rate = 0.50;
        reimbursement = miles * rate;
        printf("You traveled %.1f miles. At $%.2f per mile, your reimbursement is $%.2f ", miles, rate, reimbursement);
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote