You need to calculate the square footage of homes and their property taxes using
ID: 3801366 • Letter: Y
Question
You need to calculate the square footage of homes and their property taxes using C++. The town has some odd tax rules. All of the homes have ONLY one kitchen, one living room, one bathroom, one bedroom, and one office. The user will type in the dimensions for each room (5 rooms). 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. The tax rates should be constants in your program, Functions should be used to reduce code repetition. All functions must be commented with pre and post conditions. Example output: Do not hard code these values, your program should work for all values of length and widths) Enter in height and width of kitchen separated by a space (feet):15 15 Enter in height and width of living room separated by a space (feet):15 15 Enter in height and width of bathroom separated by a space (feet):15 15 Enter in height and width of bedroom separated by a space (feet):15 17 Enter in height and width of office separated by a space (feet):15 15 Total square footage: 1155 Total tax due: 34478.5Explanation / Answer
Driver I wrote:
#ifndef PROPERTY_H #define PROPERTY_H #include <iostream> using namespace std; class Property { //member variables: protected: int PropertyNumber; //a unique 7 digit number to reference the property string Address; //street address string City, State, ZIPCode; int Stories; //number of stories int Condition ;// condition of the property (1 - Excellent, 2 - Fair, 3 Poor) int YearBuilt; //the year the property was built double MarketValue; // the current market value of the property ($) int type; //1 for residential, 2 for commercial. No setter needed //member functions: public: //Constructors Optional Property(int pN, string add, string cty, string st, string z, int str, int c, int y, double mv, int t) { PropertyNumber = pN; Address = add; City = cty; State = st; ZIPCode = z; Stories = str; //number of stories Condition = c;// condition of the property (1 - Excellent, 2 - Fair, 3 Poor) YearBuilt = y; //the year the property was built MarketValue = mv; // the current market value of the property ($) type = t; //1 for residential, 2 for commercial. No setter needed } //getters and setters for member variables int getPropertyNumber(){return PropertyNumber;} //a unique 7 digit number to reference the property string getAddress(){return Address;} //street address string getCity(){return City;} string getState(){return State;} string getZIPCode(){return ZIPCode;} int getStories(){return Stories;} //number of stories int getCondition(){return Condition;}// condition of the property (1 - Excellent, 2 - Fair, 3 Poor) int getYearBuilt(){return YearBuilt;} //the year the property was built double getMarketValue(){return MarketValue;} // the current market value of the property ($) int gettype(){return type;} virtual void print(){} // this function should be overridden by the child classes but can be implemented to avoid redundancy virtual double calculatePropertyTaxes() {return 0;} // this function should be overridden by the child classes for now just return virtual double calculateRent(){return 0;} // this function should be overridden by the Commercial class for now just return 0 }; #endif Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.