Question

This is in c programming using functions in visual studios

Carpet Jolb A carpeting company wants to estimate what it will cost a customer to have a room carpeted. They can carpet 65 sqExample Run #1: (bold type is what is entered by the user) Enter the length of the room (in inches) 144 Enter the width of th

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Note: Could you plz go through this code and let me know if u need any changes in this.Thank You
_________________

#include <stdio.h>
#include <string.h>

#define LABOR_RATE 25.00
#define MIN_PRICE 1.00
#define MAX_PRICE 10.00
#define TIME_TO_CARPET_65SQFT 4
#define FEET_CARPET_IN_4HRS 65

double calcSquareFootage(double length, double width);
double calCarpetingHours(double squareFootage);
double calPriceOfCarpet(double squareFootage, double pricePerSqft);
double calLaborCharges(double hours);
double calTotCostOfCarpet(double priceOfCarpet, double laborRate);

int main()
{

double length, width;
double pricePerSqft;

while (1) {
printf("Enter the legth of the room (in inches):");
scanf("%lf", &length);
if (length < 0) {
printf("A Positive value for width must be entered.\n");
}
else
break;
}

while (1) {
printf("Enter the width of the room (in inches):");
scanf("%lf", &width);
if (width < 0) {
printf("A Positive value for width must be entered.\n");
}
else
break;
}

printf("Enter the price per sq. ft. of the carpet:$");
scanf("%lf", &pricePerSqft);

double squareFootage = calcSquareFootage(length, width);
printf("\nThe Square footage of the room is %.2lf sq. ft.\n", squareFootage);
double hours = calCarpetingHours(squareFootage);
printf("The number of hours required to carpet %.2lf square feet is :%.2lf hours.\n", squareFootage, hours);
double priceOfCarpet = calPriceOfCarpet(squareFootage, pricePerSqft);
printf("The price for the carpet is :$%.2lf\n", priceOfCarpet);
double laborRate = calLaborCharges(hours);
printf("The labor charges are:$%.2lf\n", laborRate);
double totCost = calTotCostOfCarpet(priceOfCarpet, laborRate);
printf("The total cost to carpet the room is:$%.2lf\n", totCost);

return 0;
}

double calcSquareFootage(double length, double width)
{

return (length / 12.0) * (width / 12.0);
}
double calCarpetingHours(double squareFootage)
{
return (squareFootage * TIME_TO_CARPET_65SQFT) / FEET_CARPET_IN_4HRS;
}
double calPriceOfCarpet(double squareFootage, double pricePerSqft)
{
return squareFootage * pricePerSqft;
}
double calLaborCharges(double hours)
{
return hours * LABOR_RATE;
}
double calTotCostOfCarpet(double priceOfCarpet, double laborRate)
{
return priceOfCarpet + laborRate;
}

___________________________

Output:

CAProgram Files (x86) Dev-Cpp MinGW64bin CarpetlaborCharges.exe nter the legth of the room くin inches):-144 A Positive value


_______________Could you plz rate me well.Thank You

Add a comment
Know the answer?
Add Answer to:
This is in c programming using functions in visual studios Carpet Jolb A carpeting company wants...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • C Language <stdio.h> (FUNCTIONS) A concrete company wants to estimate what it will cost a customer...

    C Language <stdio.h> (FUNCTIONS) A concrete company wants to estimate what it will cost a customer to have a driveway poured. They can pour a 3 inch deep 200 sq. ft. driveway in 3 hours, and they charge $50.00 per hour as their labor rate. Write a program to ask the user for the length of the driveway (in feet), and the width of the driveway (in feet) to be poured. For both the length and width, make sure the...

  • Flowchart 1: Create a flowchart for a program that calculates the total cost of carpeting a...

    Flowchart 1: Create a flowchart for a program that calculates the total cost of carpeting a room. Assume that the room is rectangular. The data required for running the program will be the length of the room, the width of the room, and the cost per square yard of the carpet. When the user runs the program it must, in the following order: Prompt for the length of the room. Prompt for the width of the room. Prompt for the...

  • I need a c++ visual basic program that will. Carpet Calculator. This problem starts with the...

    I need a c++ visual basic program that will. Carpet Calculator. This problem starts with the FeetInches class that is provided in the course Content area on the assignment page for this week. This program will show how classes will interact with each other as data members within another class. Modify the FeetInches class by overloading the following operators which should all return a bool. <= >= != Next add a copy constructor to the FeetInches class and a multiply...

  • This code is in java. Create a Java class that has the private double data of length, width, and price. Create the gets...

    This code is in java. Create a Java class that has the private double data of length, width, and price. Create the gets and sets methods for the variables. Create a No-Arg constructor and a constructor that accepts all three values. At the end of the class add a main method that accepts variables from the user as input to represent the length and width of a room in feet and the price of carpeting per square foot in dollars...

  • Need to solve this program which will run exactly like sample run .. Thanks Project 2...

    Need to solve this program which will run exactly like sample run .. Thanks Project 2 Using Classes and Objects (Chapter 3) Duc: sec calendar Two files to be submitted: . Algorithm of method main (AlgorithmOfMain.txt, no credit if this is missing) Java Source code (CarpetBill.java- no credit if this has syntax errors) Write a program that creates customers' bills for a carpet company when the information below is given: irst name .Length and width of the carpet in feet...

  • C++, please make it as simple as possible. A Paint Company is hiring you to develop...

    C++, please make it as simple as possible. A Paint Company is hiring you to develop an application to estimate the costs for a job. They have determined that for every 120 square feet of wall area, one gallon of paint and eight hours of labor is required. The company charges US$ 18.00 per hour for labor. Write a modular program that allows the user to enter the number of rooms that are to be painted and the price of...

  • A painting company has determined that for every 110 square feet of wall space, one gallon...

    A painting company has determined that for every 110 square feet of wall space, one gallon of paint and eight hours of labor will be required. The company charges $25.00 per hour for labor. Write a modular program that allows the user to enter the number of rooms that are to be painted (different colors) and the price of the paint per gallon. It should also ask for the square feet of wall space in each room. Rooms and gallons...

  • This exercise requires designing a program which solves the problem described in the problem statement below....

    This exercise requires designing a program which solves the problem described in the problem statement below. Provide comments as necessary in your pseudo-code and the Java program. Your solution must include these components: Flowchart Pseudo-code Hierarchy Chart Program Coded Program Output Problem Statement A painting company has determined that to paint 115 square feet of wall space, the task will require one gallon of paint and 8 hours of labor. The company charges $20.00 per hour for labor. Design a...

  • Job Cost Sheet Remnant Carpet Company sells and installs commercial carpeting for office buildings. Remnant Carpet...

    Job Cost Sheet Remnant Carpet Company sells and installs commercial carpeting for office buildings. Remnant Carpet Company uses a job order cost system. When a prospective customer asks for a price quote on a job, the estimated cost data are inserted on an unnumbered job cost sheet. If the offer is accepted, a number is assigned to the job, and the costs incurred are recorded in the usual manner on the job cost sheet. After the job is completed, reasons...

  • Job Cost Sheet Remnant Carpet Company sells and installs commercial carpeting for office buildings. Remnant Carpet...

    Job Cost Sheet Remnant Carpet Company sells and installs commercial carpeting for office buildings. Remnant Carpet Company uses a job order cost system. When a prospective customer asks for a price quote on a job, the estimated cost data are inserted on an unnumbered job cost sheet. If the offer is accepted, a number is assigned to the job, and the costs incurred are recorded in the usual manner on the job cost sheet. After the job is completed, reasons...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT