Question: Program using C++ Problem: You need to calculate the square footage of homes and their property taxes. The town has some odd tax rules. All
Program using C++
Problem: 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 table below.

Notes:
The tax rates should be constants in your program, not having them will cost points
Functions should be used to reduce code repetition, not having them will cost points. All functions must be commented with pre and post conditions.
At least one function should contain and utilize a pass by reference parameter
Example Output: (Do not hard code these values, your program should work for all values of length and widths). Your output should match if user provides same values. Six different example runs of the program are provided.
============================================= EXAMPLE 1 ============================================= Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit B Enter Bedroom Length: 9.4 Enter Bedroom Width: 17.2 Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit X Error: House must have at least 1 Kitchen Error: House must have at least 1 Bathroom Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit T Enter Bathroom Length: 7.2 Enter Bathroom Width: 12.2 Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit X Error: House must have at least 1 Kitchen Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit T Enter Bathroom Length: 13.6 Enter Bathroom Width: 18.9 Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit X Error: House must have at least 1 Kitchen Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit B Enter Bedroom Length: 16.7 Enter Bedroom Width: 8.5 Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit X Error: House must have at least 1 Kitchen Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit L Enter Living Room Length: 10.7 Enter Living Room Width: 12.3 Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit X Error: House must have at least 1 Kitchen Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit K Enter Kitchen Length: 9.3 Enter Kitchen Width: 16.1 Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit L Enter Living Room Length: 20.5 Enter Living Room Width: 15.3 Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit X Taxed Rooms: 7 Total SQFT: 1243.50 Total Tax: 3042.03 ============================================= EXAMPLE 2 ============================================= Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit T Enter Bathroom Length: 9.20 Enter Bathroom Width: 16.00 Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit D Enter Dining Room Length: 12.70 Enter Dining Room Width: 13.80 Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit X Error: House must have at least 1 Kitchen Error: House must have at least 1 Bedroom Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit B Enter Bedroom Length: 12.80 Enter Bedroom Width: 12.80 Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit O Enter Other Room Length: 7.50 Enter Other Room Width: 17.00 Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit K Enter Kitchen Length: 15.10 Enter Kitchen Width: 19.00 Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit L Enter Living Room Length: 16.10 Enter Living Room Width: 8.90 Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit X Taxed Rooms: 6 Total SQFT: 1043.99 Total Tax: 1954.53 ============================================= EXAMPLE 3 ============================================= Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit K Enter Kitchen Length: 20.50 Enter Kitchen Width: 8.80 Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit K Enter Kitchen Length: 8.30 Enter Kitchen Width: 15.70 Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit D Enter Dining Room Length: 12.50 Enter Dining Room Width: 11.10 Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit O Enter Other Room Length: 20.00 Enter Other Room Width: 12.10 Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit D Enter Dining Room Length: 19.30 Enter Dining Room Width: 11.00 Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit B Enter Bedroom Length: 17.10 Enter Bedroom Width: 10.40 Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit X Error: House must have at least 1 Bathroom Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit D Enter Dining Room Length: 15.60 Enter Dining Room Width: 8.20 Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit O Enter Other Room Length: 12.00 Enter Other Room Width: 18.30 Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit D Enter Dining Room Length: 20.20 Enter Dining Room Width: 18.50 Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit X Error: House must have at least 1 Bathroom Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit K Enter Kitchen Length: 15.00 Enter Kitchen Width: 17.40 Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit K Enter Kitchen Length: 19.00 Enter Kitchen Width: 11.00 Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit D Enter Dining Room Length: 17.60 Enter Dining Room Width: 17.30 Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit X Error: House must have at least 1 Bathroom Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit K Enter Kitchen Length: 13.50 Enter Kitchen Width: 17.60 Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit T Enter Bathroom Length: 13.40 Enter Bathroom Width: 18.50 Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit O Enter Other Room Length: 19.90 Enter Other Room Width: 8.90 Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit X Taxed Rooms: 15 Total SQFT: 3239.91 Total Tax: 8522.88 ============================================= EXAMPLE 4 ============================================= Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit T Enter Bathroom Length: 17.10 Enter Bathroom Width: 11.00 Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit K Enter Kitchen Length: 16.40 Enter Kitchen Width: 16.30 Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit T Enter Bathroom Length: 21.10 Enter Bathroom Width: 14.30 Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit X Error: House must have at least 1 Bedroom Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit L Enter Living Room Length: 10.40 Enter Living Room Width: 15.60 Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit B Enter Bedroom Length: 19.80 Enter Bedroom Width: 17.90 Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit X Taxed Rooms: 5 Total SQFT: 1273.81 Total Tax: 4282.51 ============================================= EXAMPLE 5 ============================================= Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit D Enter Dining Room Length: 13.50 Enter Dining Room Width: 14.20 Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit L Enter Living Room Length: 9.50 Enter Living Room Width: 18.70 Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit D Enter Dining Room Length: 14.20 Enter Dining Room Width: 12.10 Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit X Error: House must have at least 1 Kitchen Error: House must have at least 1 Bedroom Error: House must have at least 1 Bathroom Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit K Enter Kitchen Length: 10.60 Enter Kitchen Width: 18.40 Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit X Error: House must have at least 1 Bedroom Error: House must have at least 1 Bathroom Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit K Enter Kitchen Length: 9.50 Enter Kitchen Width: 16.50 Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit D Enter Dining Room Length: 17.40 Enter Dining Room Width: 11.10 Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit T Enter Bathroom Length: 9.60 Enter Bathroom Width: 16.40 Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit X Error: House must have at least 1 Bedroom Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit B Enter Bedroom Length: 18.50 Enter Bedroom Width: 13.40 Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit X Taxed Rooms: 8 Total SQFT: 1491.44 Total Tax: 2197.54 ============================================= EXAMPLE 6 ============================================= Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit O Enter Other Room Length: 17.10 Enter Other Room Width: 14.80 Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit T Enter Bathroom Length: 17.20 Enter Bathroom Width: 11.00 Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit T Enter Bathroom Length: 11.00 Enter Bathroom Width: 8.00 Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit D Enter Dining Room Length: 18.30 Enter Dining Room Width: 19.20 Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit X Error: House must have at least 1 Kitchen Error: House must have at least 1 Bedroom Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit T Enter Bathroom Length: 16.30 Enter Bathroom Width: 18.50 Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit O Enter Other Room Length: 19.20 Enter Other Room Width: 16.40 Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit X Error: House must have at least 1 Kitchen Error: House must have at least 1 Bedroom Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit T Enter Bathroom Length: 11.50 Enter Bathroom Width: 16.10 Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit D Enter Dining Room Length: 8.50 Enter Dining Room Width: 10.90 Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit D Enter Dining Room Length: 7.00 Enter Dining Room Width: 9.90 Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit X Error: House must have at least 1 Kitchen Error: House must have at least 1 Bedroom Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit O Enter Other Room Length: 8.20 Enter Other Room Width: 18.20 Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit K Enter Kitchen Length: 13.40 Enter Kitchen Width: 16.60 Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit X Error: House must have at least 1 Bedroom Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit D Enter Dining Room Length: 13.30 Enter Dining Room Width: 14.00 Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit X Error: House must have at least 1 Bedroom Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit D Enter Dining Room Length: 12.80 Enter Dining Room Width: 9.20 Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit X Error: House must have at least 1 Bedroom Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit B Enter Bedroom Length: 11.10 Enter Bedroom Width: 17.50 Select Next Room: --------------------- 1|K: Kitchen 2|B: Bedroom 3|T: Bathroom 4|L: Living Room 5|D: Dining Room 6|O: Other Room --------------------- 6|X: Exit X Taxed Rooms: 14 Total SQFT: 2715.06 Total Tax: 7628.60
Tax Levy Tax Rate per sqft Function $1.49 Kitchen Bathroom $4.50 $0.45 Bedroom $0.35 Living Room $0.55 Dining Room Any other room $1.25 Misc Tax Minimum total tax $1001 Long Wall Tax $3 per foot over 19 feet for each room length/width over 19 feet. Exception being the kitchen Luxury tax on rooms of 200 sqft and $485 added to calculated higher rooms tax per qualifying room Maximum total tax None
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
