C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN: 9781337102087
Author: D. S. Malik
Publisher: Cengage Learning
expand_more
expand_more
format_list_bulleted
Concept explainers
Textbook Question
Chapter 2, Problem 22PE
One metric ton is approximately 2,205 pounds. Write a
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
Airline companies apply baggage restrictions for their passengers. An
airline company has decided to apply a 10kg limitation for
passengers' hand luggage and 20kg for their normal baggage. When
passengers arrive, they enter their hand and normal luggage weight
from the keyboard. If passengers exceed their normal baggage
allowance of 10 dollars per gram, they pay 12 dollars per kg.
Accordingly, write the program that calculates the baggage price of
the airline they will go to according to the baggage values entered by
the arriving passenger and keeps this from closing the program for
each passenger. Note: If hand and normal baggage allowances are
stretched below the maximum value, the payment amount will be
considered not negative. An example printout is given on the right.
Geri bildirim gönder
One metric ton is approximately 2,205 pounds. Write a program that prompts the user to input the amount of rice, in pounds, a bag can hold. The program outputs the number of bags needed to store one metric ton of rice.
Given an airplane’s acceleration a and take-off speed v, you can compute the minimum runway length needed for an airplane to take off using the following formula:
length = v2/2a
Write a program that prompts the user to enter v in meters/second (m/s) and the acceleration a in meters/second squared and displays the minimum runway length.
Chapter 2 Solutions
C++ Programming: From Problem Analysis to Program Design
Ch. 2 - 1. Mark the following statements as true or...Ch. 2 - Prob. 2MCCh. 2 - Which of the following is not a reserved word in...Ch. 2 - Prob. 4SACh. 2 - 5. Are the identifiers quizNo1 and quiznol the...Ch. 2 - 6. Evaluate the following expressions. (3,...Ch. 2 - If int x = 10;, int y = 7;, double z = 4.5;, and...Ch. 2 - Prob. 8CPCh. 2 - 9. Suppose that x, y, z, and w are int variables....Ch. 2 - Prob. 10SA
Ch. 2 - Which of the following are valid C++ assignment...Ch. 2 - Write C++ statements that accomplish the...Ch. 2 - Write each of the following as a C++ expression....Ch. 2 - Prob. 14SACh. 2 - Suppose x, y, and z are int variables and wandt...Ch. 2 - 16. Suppose x, y, and z are int variables and x =...Ch. 2 - Suppose a and b are int variables, c is a double...Ch. 2 - 18. Write C++ statements that accomplish the...Ch. 2 - Which of the following are correct C++ statements?...Ch. 2 - Give meaningful identifiers for the following...Ch. 2 - 21. Write C++ statements to do the following....Ch. 2 - Prob. 22SACh. 2 - The following program has syntax errors. Correct...Ch. 2 - Prob. 24SACh. 2 - Prob. 25SACh. 2 - Preprocessor directives begin with which of the...Ch. 2 - 27. Write equivalent compound statements if...Ch. 2 - 28. Write the following compound statements as...Ch. 2 - 29. Suppose a, b, and c are int variables and a =...Ch. 2 - Suppose a, b, and sum are int variables and c is a...Ch. 2 - Prob. 31SACh. 2 - Prob. 32SACh. 2 - Prob. 33SACh. 2 - Prob. 34SACh. 2 - 1. Write a program that produces the following...Ch. 2 - Prob. 2PECh. 2 - Prob. 3PECh. 2 - 4. Repeat Programming Exercise 3 by declaring...Ch. 2 - Prob. 5PECh. 2 - Prob. 6PECh. 2 - 7. Write a program that prompts the user to input...Ch. 2 - Prob. 8PECh. 2 - 9. Write a program that prompts the user to enter...Ch. 2 - 10. Write a program that prompts the user to input...Ch. 2 - 11. Write a program that prompts the capacity, in...Ch. 2 - 12. Write a C++ program that prompts the user to...Ch. 2 - 13. To make a profit, a local store marks up the...Ch. 2 - 14. (Hard drive storage capacity) If you buy a 40...Ch. 2 - 15. Write a program to implement and test the...Ch. 2 - 16. A milk carton can hold 3.78 liters of milk....Ch. 2 - 17. Redo Programming Exercise 16 so that the user...Ch. 2 - Prob. 18PECh. 2 - 19. Write a program that prompts the user to input...Ch. 2 - 20. For each used car a salesperson sells, the...Ch. 2 - 21. Newton's law states that the force, , between...Ch. 2 - 22. One metric ton is approximately 2,205 pounds....Ch. 2 - 23. Cindy uses the services of a brokerage firm to...Ch. 2 - 24. A piece of wire is to be bent in the form of a...Ch. 2 - 25. Repeat Programming Exercise 24, but the wire...Ch. 2 - 26. A room has one door, two windows, and a...Ch. 2 - Prob. 27PECh. 2 - 28. In an elementary school, a mixture of equal...Ch. 2 - 29. A contractor orders, say, 30 cubic yards of...
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Given an airplane's acceleration and take-off speed v, you can compute the minimum runway length needed for an airplane to take off using the following formula. length=v^2/2*a. write a program that prompts the user to enter V in meters and acceleration an in meter/second and display the minimum runway length.arrow_forwardA county collects property taxes on the assessment value of property, which is 60 percent of the property’s actual value. If an acre of land is valued at $10,000, its assessment value is $6,000. The property tax is then 75¢ for each $100 of the assessment value. The tax for the acre assessed at $6,000 will be $45. Write a program that asks for the actual value of a piece of property and displays the assessment value and property tax.arrow_forwardA milk carton can hold 3.78 liters of milk. Each morning, a dairy farm ships cartons of milk to a local grocery store. The cost of producing one liter of milk is $0.38, and the profits of each carton of milk is $0.27. Write a program that does the following: a. Prompts the user to enter the total amount of milk produced in the morning. b. Outputs the number of milk cartons needed to hold milk. (round your answer to the nearest integer) c. Outputs the cost of producing milk. d. Outputs the profit for producing milk. Additional Requirements: a. The following values must be declared as named constants: The carton capacity: 3.78 The cost of one liter: 0.38 The profit on a carton: 0.27 b. Use meaningful variable and constant names c. Format any dollar amount output to two decimal placesarrow_forward
- One acre of land is equivalent to 43,560 square feet. Write a program that calculates the number of acres in a tract of land with 389,767 square feet.arrow_forwardA bag of biscuit can hold 22 biscuit, and a container can hold 70 bags of biscuit. Write a program that prompts the user to enter the total number of biscuits, the number of biscuit in a bag, and the number of biscuit bags in a container. The program then outputs the number of bags and the number of containers to ship the biscuit. Note that each bag must contain the specified number of biscuit, and each container must contain the specified number of bags. If the last bag of biscuit contains less than the number of specified biscuit, you can discard it and output the number of leftover biscuit. Similarly, if the last container contains less than the number of specified bags, you can discard it and output the number of leftover bags. Use C++ program.arrow_forwardWrite a program that inputs year and month number, it then display the number of days in that month for example if user enters 2020 in year and 3 in monthNumber the program should display “March 2020 has 31 days”.arrow_forward
- When Jacob Steinberg began his trip from California to Vermont, he filled his car’s tank with gas and reset its trip meter to 0. After traveling 324 miles, Jacob stopped at a gas station to refuel; the gas tank required 17 gallons. Jacob wants a program that calculates and displays his car’s gas mileage at any time during the trip. The gas mileage is the number of miles his car can be driven per gallon of gas. Desk-check your solution’s algorithm using 324 as the number of miles driven and 17 as the number of gallons used; then desk-check it using 280 and 15.arrow_forwardA bag of cookies holds 40 cookies. The calorie information on the bag claims that there are 10 “servings” in the bag and that a serving equals 300 calories. Write a program that asks the user to input how many cookies they actually ate and then reports how many total calories were consumed.arrow_forwardBody mass index (BMI) is a measure of health based on weight. It can be calculated by taking your weight in kilograms and dividing it by the square of your height in meters. Write a program that prompts the user to enter a weight in pounds and height in inches and displays the BMI. Note that one pound is 0.45359237 kilograms and one inch is 0.0254 meters.arrow_forward
- A parking garage charges a $2.00 minimum fee to park for up to three hours and an additional $1 per hour for each hour or part thereof over four hours. The maximum charge for any given 24-hour period is $10.00. Assume that no car parks for longer than 24 hours at a time. Write a program that will calculate and print the parking charges for each of three customers who parked their cars in this garage yesterday. You should enter the hours parked for each customer. Your program should print the results in a neat tabular format, and should calculate and print the total of yesterday's receipts. The program should use the function calculate Charges to determine the charge for each customer.arrow_forwardPaula and Danny want to plant evergreen trees along the back side of their yard. They do not want to have an excessive number of trees. Write a program that prompts the user to input the following:a. The length of the yard.b. The radius of a fully grown tree.c. The required space between fully grown trees.The program outputs the number of trees that can be planted in the yard and the total space that will be occupied by the fully grown trees.arrow_forwardSuppose you are to design a payroll program where the user inputs the employee's name, number of hours worked, hourly pay rate, federal tax rate, and state tax rate and prints a summary of the employee's paycheck. Check the two sample runs and carefully read the instructions below. Two Sample Run: Enter employee's name: Smith Enter number of hours worked in a week: 10 Enter hourly pay rate: 9.75 Enter federal tax withholding rate: 0.2 Enter state tax withholding rate: 0.09 Employee Name: Smith Hours Worked: 10.00 Pay Rate: $9.75 Gross Pay: $97.50 Deductions: Net Pay: $69.23 ● ● Federal Withholding (20.00%): $19.50 State Withholding (9.00% ) : $8.78 Total Deduction: $28.28 ● ● Enter employee's name: John Enter number of hours worked in a week: 40 Enter hourly pay rate: 12.50 Enter federal tax withholding rate: 0.15 Enter state tax withholding rate: 0.08 Instructions: Prompt user for 5 values and read the values using Scanner O Use . nextLine() method to get the String for the name Use…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Constants, Variables, Data types, Keywords in C Programming Language Tutorial; Author: LearningLad;https://www.youtube.com/watch?v=d7tdL-ZEWdE;License: Standard YouTube License, CC-BY