#include #include "rectangle.h" void main() { // cost of siding and molding are constants const float sidingCost = 2.00; const float moldingCost = 0.50; // initially, selections are not complete bool completedSelections = false; // option from menu selected by user char doorOption; // length, width, and door cost float glength, gwidth, doorCost; // total cost includes door, siding, and molding float totalCost; cout << "Enter the length and width of the garage: "; cin >> glength >> gwidth; // create garage object with user supplied dimensions. // create door object with default dimensions. Rectangle garage(glength, gwidth); Rectangle door; while (!completedSelections) { cout << "Enter 1-4 or 'q' to quit" << endl << endl; cout << "Door 1 (12 x 8; $380) " << "Door 2 (12 x 10; $420)" << endl; cout << "Door 3 (16 x 8; $450) " << "Door 4 (16 x 10; $480)" << endl; cout << endl; cin >> doorOption; if (doorOption == 'q') completedSelections = true; // terminate loop else { switch (doorOption) { case '1': door.PutLength(12); // 12 x 8 ($380) door.PutWidth(8); doorCost = 380; break; case '2': door.PutLength(12); // 12 x 10 ($420) door.PutWidth(10); doorCost = 420; break; case '3': door.PutLength(16); // 16 x 8 ($450) door.PutWidth(8); doorCost = 450; break; case '4': door.PutLength(16); // 16 x 10 ($480) door.PutWidth(10); doorCost = 480; break; } totalCost = doorCost + moldingCost * (garage.Perimeter() - garage.GetLength() + door.Perimeter() - door.GetLenght()) + sidingCost * (garage.Area() - door.Area()); cout << "total cost of door, siding, and molding: $" << totalCost << endl << endl; } } }