Lab Assignment #2

Due Tuesday, July 15 at the beginning of class

The assignment is problem #13 on page 131 (The Maripot Carpet Store) of the Lambert, Nance, and Naps book. This assignment focuses on implementing functions using value parameters and reference parameters. It also provides an opportunity to practice with formatting output. I have added some additional requirements and restrictions:


This is the template you must use:


#include <iostream.h>
#include <iomanip.h>

// function declarations
float doCustomer(int customer);
void getData(int customer /* more here */ );
void calculateCosts( /* parameters go here */ );
void printResults(int customer /* more here */ );

void main(void)
{
	float charge1  /* more here */;
	float grandTotal;
	charge1 = doCustomer(1);

	// do other 3 customers here
	// calculate grand total

	cout << "Total for all customers: " << grandTotal << endl;

}

float doCustomer(int customer)
{
	float charge;
	// more data declarations, you'll need at least 9 more

	getData(customer /* more here */ );
	calculateCosts(/* more here */);
	printResults(customer /* more here */);

	return charge;
}

void getData(int customer /* more parameters here */)
{
	cout << "Accepting data for customer " << customer << endl;
	// get input here
}

void calculateCosts(/* more parameters here */)
{  
	// calculate costs here
}

void printResults(int customer /* more paramters here */)
{
	cout << "Data for customer " << customer << endl;
	// print results here
}
How to submit your programs

Back to Outline