Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C++ program to figure out how many boxes of flooring materials are needed The user will enter the length and width (in feet)

Write a C++ program to figure out how many boxes of flooring materials are needed The user will enter the length and width (in feet) of the floor along with what percent extra (overage) to order You always want a little more material than you think.

For example, if you install tile on an angle, you waste more than if they are not on an angle. Output the number of boxes (rounded to a whole number) and the cost Each box of materials cost $21.95 and contains 40 square feet of material For example, if the dimensions are 10.5 and 12.0 feet with a 15% overage The area of the floor is 126.0 square feet 15% overage is another 18.9 square feet That is a total of 144.9 square feet which is 3.6225 boxes 3.6225 rounded is 4 boxes (because 3.6225 is closer to 4 than 3) 4 boxes will cost $87.8 this is what ai have done so far but is not giving me the right numbers:

/* * Figuring out how many boxes are needed * * Name: xxxxxxx * Date: January 29, 2023 */

# include

using namespace std;

const int quantityPerBox = 40; const double materialsCost = 21.95;

int main() { // veriables int boxQuantity; int materialNum; int subTotal; double overage; double lengthNum; double widthNum; double overageRate; double boxNum; double costNum; // prompt for cout << "Length? "; cin >> lengthNum; cout << endl; cout << "Width? "; cin >> widthNum; cout << endl; cout << "Overage? "; cin >> overageRate; cout << endl; // Math for program boxNum = (lengthNum * widthNum) / (quantityPerBox); overage = boxNum * (overageRate / 100); subTotal = boxNum + overage; costNum = subTotal * materialsCost; // output cout << " Boxes: " << boxNum << endl; cout << " Overage: " << overageRate << endl; cout << " Total Cost:" << costNum << endl; return 0; }

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_2

Step: 3

blur-text-image_3

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

Intelligent Information And Database Systems Second International Conference Acids Hue City Vietnam March 2010 Proceedings Part 1 Lnai 5990

Authors: Manh Thanh Le ,Jerzy Swiatek ,Ngoc Thanh Nguyen

2010th Edition

3642121446, 978-3642121449

More Books

Students also viewed these Databases questions

Question

=+1. What is the quality of your organization's performance?

Answered: 1 week ago