Answered step by step
Verified Expert Solution
Question
1 Approved Answer
can some help me figure out what I did wrong in this code C++ only Write a program to find the cost of painting (labor
can some help me figure out what I did wrong in this code C++ only
Write a program to find the cost of painting (labor plus paint cost) the following wall. The labor for painting is $15 per hour and it takes 1 hour to paint 0.5 gallons of paint. Blue paint costs $4.5/ gallon, yellow paint costs $4.2/gallon, and red paint costs $3.5/gallon. One gallon of paint covers 2 square feet. Ask the user to provide the length and width of the wall, window, and the door. This is an individual assignment. You can use notes or your programs but you should not provide or seek help from anyone else. Make sure to add comments in your program. main() float walllength, wallwidth, windowlength, windowWidth, doorlength, doorwidth, wallarea, ndowArea, doorArea; //Ask user for wall dimensions cout "Enter the length of the wall: "; getline(cin, walleength); cout "Enter the width of the wall: "; getline(cin, wallwidth); //Calculate wall area wallArea = wallLength * wallwidth; //Ask user for window dimenstons cout \& "Enter the length of the window: "; getline(cin, windowlength); cout "Enter the width of the window: "; getline(cin, windowWidth); //Calculate window area windowArea = windowLength * windowWidth; //Ask user for door dimenstons cout "Enter the length of the door: "; getline(cin, doorlength); cout "Enter the width of the door: "; getline(cin, doorwidth); //Calculate door area doorArea = doorLength * doorwidth; //Calculate window area windowArea = windowLength * windowWidth; //Ask user for door dimensions cout "Enter the length of the door: "; getline(cin, doorlength); cout "Enter the width of the door: "; getline(cin, doorwidth); //Calculate door area doorArea = doorlength * doorwidth; float totalArea, totalpaintcost, totallaborcost, totalGallon, totalhours, theTotalCost; //Calculate total area to be painted totalArea = wallArea + windowArea + doorArea; //Calculate paint cost totalpaintcost = (wallArea /2.0)4.5+ (windowArea /2.0 ) 4.2+ (doorArea /2.0) * 3.5; //Calculate total gallon paint required totalGallon=totalArea / 2.0; //Calculate total hours totalhours = totalGallon * 2 ; //Calculate labor cost totallaborCost = totalHours * 15 ; theTotalcost = totalpaintcost + totallaborcost //Print total cost cout "Total cost: \( \$ " \ll \)quot; theTotalcost endl; //printf("Total cost: \$\%.2f ", totalPaintCost + totallaborcost); return 0 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