You need to calculate the square footage of homes and their property taxes. The
ID: 3834316 • Letter: Y
Question
You need to calculate the square footage of homes and their property taxes. The town has some odd tax rules. All of the homes have at least one kitchen, bathroom, and a bedroom. However, they can also have additional bedrooms, bathrooms, living rooms, and/or a dining room. The user will be able to tell you which rooms they have and the length and width of each room. Each run of the program should calculate and display the total square footage as well as the total taxes due. The property taxes are calculated based on the type and size of the room according to the following table. Example Output (Do not hard code these values, your program should work for all values of length and widths) See provided .txt file for example output, your output should match if user provides same values. Six different example runs of the program are provided.Explanation / Answer
Here is the code for you:
#include <iostream>
#include <iomanip>
#define KITCHEN_TAX 1.49
#define BATHROOM_TAX 4.50
#define OTHERROOM_TAX 1.25
#define MINIMUM_TAX 1001.00
#define LONGWALL_TAX 3.00
#define LONGWALL 19
#define LUXURY_TAX 485
#define LUXURYROOM 200
//#define MAXIMUM_TAX 45500
double kitchenTax(double height, double width)
{
double taxAmount = 0.0;
double area = height * width;
taxAmount = area * KITCHEN_TAX;
if(area >= LUXURYROOM)
taxAmount += LUXURY_TAX;
return taxAmount;
}
double otherRoomTax(double height, double width)
{
double taxAmount = 0.0;
double area = height * width;
taxAmount = area * OTHERROOM_TAX;
if(height >= LONGWALL)
taxAmount += (height-LONGWALL) * LONGWALL_TAX;
if(width >= LONGWALL)
taxAmount += (width-LONGWALL) * LONGWALL_TAX;
if(area >= LUXURYROOM)
taxAmount += LUXURY_TAX;
return taxAmount;
}
double bathRoomTax(double height, double width)
{
double taxAmount = 0.0;
double area = height * width;
taxAmount = area * BATHROOM_TAX;
if(height >= LONGWALL)
taxAmount += (height-LONGWALL) * LONGWALL_TAX;
if(width >= LONGWALL)
taxAmount += (width-LONGWALL) * LONGWALL_TAX;
if(area >= LUXURYROOM)
taxAmount += LUXURY_TAX;
return taxAmount;
}
using namespace std;
int main()
{
double taxAmount = 0.0;
double totalFootage = 0;
double height, width;
cout << "Enter the height and width of kitchen separated by a space (feet): ";
cin >> height >> width;
totalFootage += height * width;
taxAmount += kitchenTax(height, width);
cout << "Enter the height and width of living room separated by a space (feet): ";
cin >> height >> width;
totalFootage += height * width;
taxAmount += otherRoomTax(height, width);
cout << "Enter the height and width of bathroom separated by a space (feet): ";
cin >> height >> width;
totalFootage += height * width;
taxAmount += bathRoomTax(height, width);
cout << "Enter the height and width of bedroom separated by a space (feet): ";
cin >> height >> width;
totalFootage += height * width;
taxAmount += otherRoomTax(height, width);
cout << "Enter the height and width of office separated by a space (feet): ";
cin >> height >> width;
totalFootage += height * width;
taxAmount += otherRoomTax(height, width);
//if(taxAmount > MAXIMUM_TAX)
// taxAmount = MAXIMUM_TAX;
cout << "Total square footage: " << totalFootage << endl;
cout << "Total tax due: " << taxAmount << endl;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.