Question: Write a program in C++ wherein users will provide the number of rooms in their apartment along with the dimensions of each room in terms
Write a program in C++ wherein users will provide the number of rooms in their apartment along with the dimensions of each room in terms of its length and width (in feet and inches). Using these inputs your program should tell the user what will be the total cost to carpet the entire apartment.
Note: 1 feet = 12 inches
Cost of carpeting = $2.51/ft^2
Make sure for room dimensions; the user is not able to input a negative value. In case they do, they should be prompted and asked to re-enter the dimensions again with a valid input. Also, the input for number of rooms should be at least 1. Your program must use for loops in computing the total carpeting cost.
The entire program should be able to run as many times as a user wants.
Make sure your code is well documented and output is well structured.
Input Cases:
Rooms = -7 (Correct: 2)
Room 1:
Length: 7 ft and -7 (correct: 2) inches
Width: -9 (correct: 9) ft and 9 inches
Room 2:
Length: 11 ft and 4 inches
Width: 10 ft and 10 inches
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
