Question
we are writing a program that asks the user the enter the length and width of a room in feets and inches and then combin
we are writing a program that asks the user the enter the length and width of a room in feets and inches and then combin them and calculates the area of the room. however when my profesor gave us an example result his program combined the length in feet of 18 and length in inches of 11 and combined them to 18.11 and when I wrote my program it's giving me a result of 11.8 how can I make my program just combin the 2 numbers together.
here is how I wrote my program:
const float
LABOR_COST = 1.65,
TAX_RATE = 0.06825;
int main()
{string dash;
string name;
int custidnum;
float lenf, leni, widf , widi , carppsf, disc, incInLFT, incInWFT, discInD, totLenInFt, totWInFt, areaSqFt, totAreaSf, labor, insPr, totDisc, subTot, tax, total;
// Input Section:
cout << "Enter Customer Name : "; getline(cin, name);
cout << "Enter Customer ID Number: : "; cin >> custidnum;
cout << "Enter Length in Feet : "; cin >> lenf;
cout << "Enter Length in Inches : "; cin >> leni;
cout << "Enter Width in Feet : "; cin >> widf;
cout << "Enter Width in Inches: " ; cin >> widi;
cout << "Enter carpet Price per Square foot : "; cin >> carppsf;
cout << "Enter Percentagge of discount : "; cin >> disc;
// Processing Section:
incInLFT = leni / 12;
incInWFT = widi / 12;
discInD = disc / 100;
totLenInFt = lenf + incInLFT;
totWInFt = widf + incInWFT;
areaSqFt = totLenInFt * totWInFt;
totAreaSf = areaSqFt * carppsf;
labor = areaSqFt * LABOR_COST;
insPr = totAreaSf + labor;
totDisc = insPr * discInD;
subTot = insPr - totDisc;
tax = subTot * TAX_RATE;
total = subTot + tax;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started