This is a value returning function program. A moving contractor wants you to wri
ID: 3647494 • Letter: T
Question
This is a value returning function program. A moving contractor wants you to write a program that can use to estimate the cost of moving a residential customer. The charge to move a customer is based on two factors. First, the labor cost is estimated by charging $4 for every 100 pounds of furniture to be moved. Second, the travel charge is $50 plus $1. 75 for each mile the furniture is moved. Inside main declare variables to store weight to be moved and distance to be moved. Pass two variables to "Input" function called buy main to input the values from the keyboard. The function should prompt the user for the estimated weight of the furniture and the distance the furniture is to be moved. Inside main call a value returning function "Total Charges" by passing two variables. 'Total Charges' function that displays the Weight, Distance and calculated labor charge, the travel charge, and the total charge inside a function and also return the total charges" to main for printing. Use the following dataExplanation / Answer
please rate - thanks
#include <iostream>
using namespace std;
void Input(double&,double&);
double TotalCharges(double,double);
int main()
{double weight,distance,charges;
Input(weight,distance);
charges=TotalCharges(weight,distance);
cout<<"The charges to move "<<weight<<" pounds of "
<<" furniture "<<distance<<" miles is $"<<charges<<endl;
system("pause");
return 0;
}
void Input(double& w,double& d)
{cout<<"Enter the weight of the furniture to move: ";
cin>>w;
cout<<"Enter the number of miles moving: ";
cin>>d;
}
double TotalCharges(double w,double d)
{double labor, travel,total;
labor=(int)((w+99)/100)*4; //this rounds up so 550 miles will be 6*$4
travel=1.75*d+50;
total=labor+travel;
return total;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.