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

Modify program 3 as follows: Step 1: Inside main, declare two arrays: Weight and

ID: 3647496 • Letter: M

Question

Modify program 3 as follows: Step 1: Inside main, declare two arrays: Weight and Distance each of size 3 to store 3 readings of weight and distance respectively. Step 2: Inside main pass two arrays to function "Input" to input Weight and Distance from the keyboard. Step 3: Inside main pass two arrays to a function "Total Charges" that will calculate and display the Weight, Distance and calculated labor charge, the travel charge, and the total charges with two decimal places and in a total of 12 spaces. Use the following data

Explanation / Answer

please rate - thanks

#include <iostream>
#include <iomanip>
using namespace std;
void Input(double[],double[]);
void TotalCharges(double[],double[]);
int main()
{double weight[3],distance[3],charges;
Input(weight,distance);
TotalCharges(weight,distance);
system("pause");
return 0;
}
void Input(double w[],double d[])
{int i;
for(i=0;i<3;i++)
   {cout<<"For move "<<i+1<<" ";
    cout<<"Enter the weight of the furniture to move: ";
     cin>>w[i];
     cout<<"Enter the number of miles moving: ";
    cin>>d[i];
}
}
void TotalCharges(double w[],double d[])
{
int i;
double labor, travel,total;
for(i=0;i<3;i++)
   {cout<<"For move "<<i+1<<": ";
    labor=(int)((w[i]+99)/100)*4; //this rounds up so 550 miles will be 6*$4
    travel=1.75*d[i]+50;
    total=labor+travel;
    cout<<"The charges to move "<<w[i]<<" pounds of "
    <<"furniture "<<d[i]<<" miles is $"<<setw(12)<<setprecision(2)<<fixed<<total<<endl;
}
}
     

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