Write a menu driven program that allows you a contractor to estimate the cost of building a house. The program should ask the user for the following information: number of rooms, size of each room, style of each rooms (all rooms do not have to have same style). Styles: 1 = Standard, 2 = Deluxe, 3 = Superior. The following values are used for costs: Standard = $122 sq/ft, Deluxe = $199 sq/ft, Superior = $299 sq/ft.
Display the cost of each room and total cost of the house.
Allow for multiple houses to be prices.I think I'm going in the right direction, but I'm having trouble pricing multiple rooms and houses. Did I take the right approach for this problem?
CODE
#include <iostream.h>
#include <conio.h>
#include <iomanip.h>
const float STANDARD = 122.00;
const float DELUXE = 199.00;
const float SUPERIOR = 299.00;
void main ()
{
int choice, length, width, area, cost;
cout << fixed << showpoint << setprecision(2);
do
{
cout << "\n\t\tHouse Pricing Menu\n\n";
cout << "1. Standard style room\n";
cout << "2. Deluxe style room\n";
cout << "3. Superior style room\n";
cout << "4. Quit the Program\n\n";
cout << "Enter your choice: ";
cin >> choice;
while (choice < 1 || choice > 4)
{
cout << "Please enter 1, 2, 3, or 4: ";
cin >> choice;
}
if (choice !=4)
{
cout << "Please enter length of room in feet: ";
cin >> length;
cout << "Please enter width of room in feet: ";
cin >> width;
area = length * width;
cout << "The area of the room is: " << area << endl;
}
switch (choice)
{
case 1: cost = area * STANDARD;
break;
case 2: cost = area * DELUXE;
break;
case 3: cost = area * SUPERIOR;
break;
}
cout << "The total cost of the room is $";
cout << cost << endl;
} while (choice !=4);
}