Samples of the last homework assignment


void main(void)
{

    //declare local variables representing each customer's
    //purchase
  float charge1, charge2, charge3, charge4;

    //a place holder for the cost of all four customer's
    //purchases
  float grandTotal;

    //get data and total for customer 1
  charge1 = doCustomer(1);

    //get data and total for customer 2
  charge2 = doCustomer(2);

    //get data and total for customer 3
  charge3 = doCustomer(3);

    //get data and total for customer 4
  charge4 = doCustomer(4);

    //tally the grand total charge for all customers
  grandTotal = charge1 + charge2 + charge3 + charge4;

    //display the result for grand total
  cout.setf(ios::fixed);
  cout << endl << setw(26) << "Total for all customers: $"
  cout << setprecision(2) << setw(7) << grandTotal << endl;

}



Next page
Previous page
Go to Lesson 7 index.


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