The last homework assignment, con't
//Begin calculateCosts
void calculateCosts(int sq_yds,
float cost_per_sq_yd,
float labor_per_sq_yd,
float prep_cost,
float &cost_carpet,
float &cost_labor,
float discount_rate,
float &discount,
float &tax,
float &charge)
{
//calculate the total cost of carpet
cost_carpet = sq_yds * cost_per_sq_yd;
//calculate the total cost of labor
cost_labor = (sq_yds * labor_per_sq_yd) + prep_cost;
//calculate the customer's discount
discount = (cost_carpet * discount_rate);
//calculate the tax for current customer
tax = (cost_carpet - discount) * TAX_RATE;
//calculate the total charge to current customer
charge = (cost_carpet - discount + tax + cost_labor);
}
//End calculateCosts
Previous page
Go to Lesson 7 index.