Write a C
a. the length and the width of the carpet in feet
b. the carpet price per square foot
c. the percent of discount for each customer
The labor cost is fixed at
The program's design should use main and at least the six functions described below:
a. Read data from the keyboard. This function is to use addresses to read all data and place them in the calling function's variables.
b. Calculate values. This function calls three subfunctions. Each function is to use addresses to store their results.
c. Print the result. Use two subfunctions to print the results: one to print the measurements, and one to print the charges.
Test your program with the test data shown in Table 4-3.
Want to see the full answer?
Check out a sample textbook solutionChapter 4 Solutions
Computer Science: A Structured Programming Approach Using C, Third Edition
- Write a C Program A bank wants a program that determines the yearly interest earned on a guaranteed investment certificate (GIC), given a number of years. If the investment is for five years, the interest is 8.2% per year; if it is for one year, the interest is 5%. Print on the screen "Invalid data. Please try again later.", if the user enters any value other than 1 or 5 for the number of years of investment. Write a complete C program to determine the amount of interest earned per year. Hint: Interest - amount * percentagearrow_forwardCODE IN C++ Language: Given two sets of inputs: a time (two inputs: the first is the hour which is an integer of 1-12, the second whether the time of the day is am denoted by 'a' or pm denoted by 'p'); and, a number n referring to how many hours is to be added which is an integer of 1-11, find the resulting time after we add the inputted time with the number of hours n inputted. Input The first line is two inputs: the first being the hour (1-12) and the second being am or pm ('a' or 'p'), The second line is any integer from 1 to 11 1 p 7 Output: The time in hours and whether am or pm. 8 pmarrow_forwarda. USING C PROGRAMMING LANGUAGE Write a program to process a collection of the speeds of vehicles. Your program should count and print the number of vehicles moving at a high speed (90 miles/hour or higher), the number of vehicles moving at a medium speed (50–90 miles/hour), and the number of vehicles moving at a slow speed (less than 50 miles/hour). It should also display the category of each vehicle. Test your program on the following data: Speed of vehicles (in miles): 43 23 54 57 68 67 51 90 33 22 11 88 34 52 75 12 78 32 89 14 65 67 97 53 10 47 34 b. Modify your program to display the average speed of a vehicle (a real number) at the end of the run.arrow_forward
- Written in C# Language Please! A fixed percentage of water is taken from a well each day. Request values for W and P where: ▪ W is the amount (in litres) of water in the well at the start of the first day ▪ P is the percentage of the water in the well taken out each day Write a program to print the number of the day, the amount taken for that day and the amount remaining at the end of the day. The output should be terminated when 30 days have been printed or the amount of water remaining is less than 100 litres, whichever comes first. For example, if W = 1000 and P = 10, the output should start as follows: Day Amount Taken Amount Remaining 1 100 900 2 90 810 3 81 729 Note: The amount taken and amount remaining should be displayed to 2 decimal places.arrow_forwardC++ - When analyzing data sets, such as data for human heights or for human weights, a common step is to adjust the data. This can be done by normalizing to values between 0 and 1, or throwing away outliers. For this program, adjust the values by subtracting the smallest value from all the values. The input begins with an integer indicating the number of integers that follow. Ex: If the input is: 5 30 50 10 70 65 the output is: 20 40 0 60 55 The 5 indicates that there are five values in the list, namely 30, 50, 10, 70, and 65. 10 is the smallest value in the list, so is subtracted from each value in the list. For coding simplicity, follow every output value by a space, including the last one.arrow_forwardPRG10: Write a program that accepts dates written in numerical form and outputs in complete form. :5 26 1986 : May 26, 1986 Enter date in number form Your date in complete form is PRG11: Write a program that will calculate and show bills of the Manila Electric Company. The rates vary depending on whether the useR is residential (R), commercial( C) , or industrial (I). Any other code should be treated as an error. The program should accept the subscriber ID, Subscriber Name, his total electrical consumption in a month, and the code of the consumer type. The rates are computed as follows: R: 50 plus .50 per kwh used C: 100 for the first 1000 kwh and 0.45 for each additional kwh I: 180 for the first 1000 kwh and 0.75 for each additional kwh PRG12: Write a program that will simulate the Paper, Rock, Scissors game. Two players should be able to either P, R or S then the program shall determine who the winner is and state why he wins based on the following criteria: Sample Output Paper…arrow_forward
- Cecilia's Boutique wants several lists of salesperson data. Design a flowchart (jpeg) and pseudocode (c program) for the following: A program that accepts one salesperson's ID number, number of items sold in the last month, and the total value of the items and displays data message only if the salesperson is a high performer—defined as a person who sells more than 200 items in the month. A program that accepts the salesperson's data and displays a message only if the salesperson is a high performer—defined as a person who sells more than 200 items worth at least $1,000 in the month.arrow_forwardThis is an computer programming question The code should be in C++ language Write a program that reads the test scores of 25 students in the range 0–100. It should then determine the number of students having scores in each of thefollowing ranges: 0–24, 25–49, 50–74, 75–100. Output the score rangesand the number of students.Run your program with the following input data: 76, 89, 70, 35, 100,76, 12, 97, 50, 28, 78, 89, 67, 100, 75, 49, 87, 99,29, 47, 76, 20, 87, 35, 57.arrow_forward(Modify) a. Modify the program you wrote for Exercise 7 to provide the mass of a person as an output, given his or her weight as an input to the program. Use your program to determine the mass of a person who weighs 140 lbf on Earth. b. Modify the program written for Exercise 7a to also output the person’s weight on Mars and the moon. The pull of gravity on Mars is 12.54ft/sec2=3.728m/s2,andonthemoonis5.33ft/sec2=1.625m/s2.arrow_forward
- (Numerical) Write a program that tests the effectiveness of the rand() library function. Start by initializing 10 counters to 0, and then generate a large number of pseudorandom integers between 0 and 9. Each time a 0 occurs, increment the variable you have designated as the zero counter; when a 1 occurs, increment the counter variable that’s keeping count of the 1s that occur; and so on. Finally, display the number of 0s, 1s, 2s, and so on that occurred and the percentage of the time they occurred.arrow_forwardWhen you borrow money to buy a house, a car, or for some other purpose, you repay the loan by making periodic payments over a certain period of time. Of course, the lending company will charge interest on the loan. Every periodic payment consists of the interest on the loan and the payment toward the principal amount. To be specific, suppose that you borrow $1,000 at an interest rate of 7.2% per year and the payments are monthly. Suppose that your monthly payment is $25. Now, the interest is 7.2% per year and the payments are monthly, so the interest rate per month is 7.2/12 = 0.6%. The first months interest on $1,000 is 1000 0.006 = 6. Because the payment is $25 and the interest for the first month is $6, the payment toward the principal amount is 25 6 = 19. This means after making the first payment, the loan amount is 1,000 19 = 981. For the second payment, the interest is calculated on $981. So the interest for the second month is 981 0.006 = 5.886, that is, approximately $5.89. This implies that the payment toward the principal is 25 5.89 = 19.11 and the remaining balance after the second payment is 981 19.11 = 961.89. This process is repeated until the loan is paid. Write a program that accepts as input the loan amount, the interest rate per year, and the monthly payment. (Enter the interest rate as a percentage. For example, if the interest rate is 7.2% per year, then enter 7.2.) The program then outputs the number of months it would take to repay the loan. (Note that if the monthly payment is less than the first months interest, then after each payment, the loan amount will increase. In this case, the program must warn the borrower that the monthly payment is too low, and with this monthly payment, the loan amount could not be repaid.)arrow_forward(Numerical) Using the srand() and rand() C++ library functions, fill an array of 1000 floating-point numbers with random numbers that have been scaled to the range 1 to 100. Then determine and display the number of random numbers having values between 1 and 50 and the number having values greater than 50. What do you expect the output counts to be?arrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr