The last homework assignment, con't


// Implementation of the primary function used to control the processing
// of data input, calculated, and output.
float doCustomer (int customer)
{
  float charge;                 // total charge to customer  
  float total_square_yards;     // number of square yards
						  // of carpet bought

  float cost_per_square_yards;  // carpet cost per square yard
  float unit_labor_cost;        // labor cost calculated per sq yard
  float prep_cost;              // floor preparation cost
  float discount_rate;          // customer's discount percentage
  float cost_of_carpet;         // calculated cost of carpet
  float cost_of_labor;          // labor cost including floor prep
  float discount_on_carpet;     // customer's discount
  float tax_on_carpet;          // tax on carpet only

  // get data from user
  getData (customer, total_square_yards, cost_per_square_yards,
	      unit_labor_cost, prep_cost, discount_rate);

  // calculate the costs using data inputted
  calculateCosts (customer, total_square_yards, cost_per_square_yards,
		        unit_labor_cost, prep_cost, discount_rate,
		        cost_of_carpet, cost_of_labor, discount_on_carpet,
		        tax_on_carpet, charge);

  // format and print the input data and calculated costs
  printResults (customer, total_square_yards, cost_per_square_yards,
		      unit_labor_cost, prep_cost, discount_rate,
		      cost_of_carpet, cost_of_labor, discount_on_carpet,
		      tax_on_carpet, charge);

  // return total charge for this customer
  return charge;

} // End of doCustomer function.



Next page
Previous page
Go to Lesson 7 index.


HTML by Jennifer Keiser.
Sponsored by Inspiration, the diagramming and outlining tool.