Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

With the housing market the way it is, you need to make quick mental calculations fast! Sometimes that's not so easy to do after a

With the housing market the way it is, you need to make quick mental calculations fast! Sometimes that's not so easy to do after a long day, so how about writing a computer program that will calculate the square footage of a house for you? The program should prompt the user for the total number of rooms in the house, then allow the user to enter the length and width of each room individually. After all the data entry has been performed, the program should display the total square footage of the house. Here's what a sample run looks like:

How many rooms? 5

Room #1:

Enter length: 20

Enter width: 35

Room #2:

Enter length: 18.7

Enter width: 25.3

Room #3:

Enter length: 12.1

Enter width: 15

Room #4:

Enter length: 28.6

Enter width: 22.2

Room #5:

Enter length: 26

Enter width: 11.4

The total square feet is 2285.9300

A few things to take note of: The values entered may contain decimal points. The total square feet is expressed as a floating point value. The total square feet uses four digits of precision. Naturally, since this is a programming class you don't get to write this program any which way you prefer, there are a few rules to this game. The main function will be responsible for getting the number of rooms from the user. Then this value is passed as input to the CalcSquareFeet function. What CalcSquareFeet does is prompt the user for the length and width of each room and return the total square footage to the caller. However, to derive the area of a single room, CalcSquareFeet will call on another function CalcArea. This function will receive length and width values for a single room and return the area back to the caller.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Analytics Systems Engineering Cybersecurity Project Management

Authors: Christopher Greco

1st Edition

168392648X, 978-1683926481

Students also viewed these Databases questions