C++ How to Program (10th Edition)
10th Edition
ISBN: 9780134448237
Author: Paul J. Deitel, Harvey Deitel
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
An online retailer sells five products whose retail prices are as follows:
Product 1, $2.98; product 2, $4.50; product 3, $9.98; product 4, $4.49 and product 5, $6.87.
Write an application that reads a series of pairs of numbers as follows:
a) product number
b) quantity sold
Your program should use a switch statement to determine the retail price for each
product. It should calculate and display the total retail value of all products sold. Use a
sentinel-controlled loop to determine when the program should stop looping, until
product number not equal to 0 and display the final results.
The Output as shown:
Enter product number (1-5 or 0 to stop): 1
Enter quantity sold: 5
Enter product number (1-5 or 0 to stop): 5
Enter quantity sold: 3
Enter product number (1-5 or 0 to stop): 4
Enter quantity sold: 4
Enter product number (1-5 or 0 to stop): 3
Enter quantity sold: 6
Enter product number (1-5 or 0 to stop): 5
Enter quantity sold: 2
Enter product number (1-5 or 0 to stop): 0
Total retail…
c++
Time CalculatorWrite a program that asks the user to enter a number of seconds.-There are 60 seconds in a minute. If the number of seconds entered by the user is greater than or equal to 60, the program should display the number of minutes and leftover seconds in that many seconds.-There are 3,600 seconds in an hour. If the number of seconds entered by the user is greater than or equal to 3,600, the program should display the number of hours, minutes, and leftover seconds in that many seconds.-There are 86,400 seconds in a day. If the number of seconds entered by the user is greater than or equal to 86,400, the program should display the number of days, hours, minutes, and leftover seconds in that many seconds.
Chapter 5 Solutions
C++ How to Program (10th Edition)
Ch. 5 - Describe the four basic elements of...Ch. 5 - Compare and contrast the while and for iteration...Ch. 5 - Prob. 5.7ECh. 5 - Compare and contrast the break and continue...Ch. 5 - (Find the Code Errors) Find the error (s), if any,...Ch. 5 - Prob. 5.10ECh. 5 - (Find the Smallest Value) Write an application...Ch. 5 - (Calculating the Product of Odd Integers) Write an...Ch. 5 - (Factorials) Factorials arc used problems. The...Ch. 5 - (Modified Compound-Interest Program) Modify the...
Ch. 5 - (Triangle-Printing program)Write an application...Ch. 5 - (Bar- Chart Printing Program) One interesting...Ch. 5 - (Calculating Sales) An online retailer sells five...Ch. 5 - Assume thati = 1, j = 2, k = 3and m = 2. What does...Ch. 5 - (Calculate the value of ) Calculate the value of ...Ch. 5 - (Pythagorean Triples) A right triangle can have...Ch. 5 - (Modified Triangle-Printing Program) Modify...Ch. 5 - (De Morgan`s Laws)In this chapter, we discussed...Ch. 5 - (Diamond -Printing Program) Write an application...Ch. 5 - (Diamond -Printing Program) Write an application...Ch. 5 - Removing break and continue) A criticism of the...Ch. 5 - Prob. 5.26ECh. 5 - Replacing continue with a structured Equivalent)...Ch. 5 - Prob. 5.28ECh. 5 - (Peter Minuit Problem) Legend has it that, in...Ch. 5 - (Dollar Amount Constructor with Two Parameters)...Ch. 5 - (Dollar Amount Arithmetic) Enhance class Dollar...Ch. 5 - Prob. 5.32ECh. 5 - (Dollar Amount with dollars cents Data Members)...Ch. 5 - (Account Class That Stores a Dollar Amount)...Ch. 5 - (Displaying the Interest Rate in the Dollar Amount...Ch. 5 - (Showing That double Values Are Approximate)...Ch. 5 - (Global Warming Facts Quiz) The controversial...Ch. 5 - (Global Warming Facts Quiz) The controversial...Ch. 5 - (Tax Plan Alternatives: The "Fair' Tax") There are...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Explain the difference between using a computer program and programming a computer.
Big Java Late Objects
Apply the normalization process to the Veterinary Office ListVersion One relation shown in Figure 1-34 (see pag...
Database Concepts (8th Edition)
Using the university schema, write an SQL query to find the IDs of those students who have retaken at least thr...
Database System Concepts
The ____________ is always transparent.
Web Development and Design Foundations with HTML5 (8th Edition)
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
- mystery_value = 5 #You may modify the lines of code above, but don't move them!#When you Submit your code, we'll change these lines to#assign different values to the variables. #Write a program that divides mystery_value by mystery_value#and prints the result. If that operation results in an#error, divide mystery_value by (mystery_value + 5) and then#print the result. If that still fails, multiply mystery_value#by 5 and print the result. You may assume one of those three#things will work.##You may not use any conditionals.# #Add your code here!arrow_forward09. FizzBuzz problem:- Write a program which return "fizz" if the number is a multiplier of 3, return "buzz" if its multiplier of 5 and return "fizzbuzz" if the number is divisible by both 3 and 5. If the number is not divisible by either 3 or 5 then it should just return the number itself?.arrow_forwardProblem definition: A college wants to know how well its students did on an exam. The following program summarizes the results. The program asks a user to enter the results pass (1) or fail (2) for 10 students. It displays the number of passed and the number of failed. It displays a message "Raise error" if the number of passes is more than 8 You are asked to identify statement with syntax errors by selecting them as wrong and the correct statements as rightarrow_forward
- Microwaves / Radio Waves If a scientist knows the wavelength of an electromagnetic wave she can determine what type of radiation it is. Write a program that asks for the wavelength in meters of an electromagnetic wave and then displays what that wave is according to the following chart. (For example, a wave with a wavelength of 1E-10 meters would be an X-ray.) 1x 10-11 1 x 10-8 4 x 10-7 7x 10-7 1x 10-3 1 x 10-2 Gamma Rays. X Rays Ultraviolet Visible Light Infraredarrow_forwardA mail-order house sells five products whose retail prices are as follows: Product 1, $2.98; product 2, $4.50; prod- uct 3, $9.98; product 4, $4.49 and product 5, $6.87. Write an application that reads a series of pairs of numbers as follows: a) product number b) quantity sold Your program should use a switch statement to determine the retail price for each product. It should calculate and display the total retail value of all products sold. Use a sentinel-controlled loop to determine when the pro- gram should stop looping and display the final results.arrow_forwardQ3a) Summary Newton’s law states that the force, F, between two bodies of masses M1 and M2 is given by: in which k is the gravitational constant and d is the distance between the bodies. The value of k is approximately 6.67 X 10-8 dyn. cm²/g² . Instructions Write a program that prompts the user to input: The masses of the bodies The distance between the bodies. The program then outputs: The force between the bodies. Your program should be able to work with decimals. Q3b) Cindy uses the services of a brokerage firm to buy and sell stocks. The firm charges 1.5% service charges on the total amount for each transaction, buy or sell. When Cindy sells stocks, she would like to know if she gained or lost on a particular investment. Instructions Write a program that allows Cindy to input: The purchase price of each share The selling price of each share The number of shares sold The program outputs: The total amount invested The total amount received from selling The total service…arrow_forward
- C#arrow_forwardAn online book club awards points to its customers based on the number of books purchased each month. Points are awarded as follows: Books Purchased Points Earned 1 5 2 15 3 30 4 or more 60 Write a program that asks the user to enter the number of books purchased this month and then displays the number of points awarded.arrow_forwardComments Target Outcome: (CO2) Write algorithms to solve different programming problems using flowchart and pseudo-code. No Comm Problem: The program will display the following when run: 1. Display Pass/Fail Data 2. Display Final Grade Classification 3. Display Mean and Median Score Call the following function when the user selects from the menu: 1. Determine the number of students who passed (>-75%) and failed (<75%). Plot also the pass/fail data using a pie chart. 2. Classify and plot (using bar graph) the final grades based on the following: Expert (95%-100%) ndar: Compctent (85%-94%) Novice (75%-84%) Beginner (<75%) 3. Calculate the mean and median final gradc. Plot the mean and median score with the plot of all the nnal grades. Create an algorithm for the programming problcm abovc using pscudo-code or flowchart. 29°C earcharrow_forward
- True or False The test expression in a switch statement can be a double or a decimal value.arrow_forwardBox Office: A movie theater only keeps a percentage (20%) of the revenue earned from ticket sales. The remainder goes to the movie distributor. Write a program that calculates a theater’s gross and net box office profit for a night. The program should ask for the name of the movie, and how many adult and child tickets were sold. (The price of an adult ticket is $10.00 and a child’s ticket is $6.00.) Input: the name of the movie, number of adult tickets sold, number of child tickets sold Output: as specified below Object: cin, cout, getline, format output Note: 1. Movie names contain spaces 2, the report is aligned. 3. The decimal number is displayed with 2 decimal places.arrow_forwardRemaining Time: 54 minutes, 49 seconds. * Question Completion Status: QUESTION 19 Write a Java program that prompts the user to enter the School Grade Level of a student and then calculate their discount amount in the regular fees structure offered during this pandemic situation. By using the below table, calculate their discount amount from the amount of the regular fee and then print the discount amount in OMR by using the appropriate selection structure. (Assume the user is entering a maximum Grade level is 12) discount amount = Regular Fees * percentage of discount rate School Grade Level Regular Fees in OMR Discount Rate >9 and 6 and 3 and 0 and <=3 30.500 5% otherwise 20.400 No discount T T T Arial 3 (12pt) v T -E E- 只i ン Click Save and Submit to save and submit. Click Save All Answers to save all answers. Save All Answers TOSHIBA F5 F6 F7 F8 F9 F10 F11 F12 INS SCNULL LOCK AD & 67 7 V 8A9 4 0arrow_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 LearningProgramming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage Learning
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage
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
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Control Structure in Data Structure - Data Structures - Computer Science Class 12; Author: Ekeeda;https://www.youtube.com/watch?v=9FTw2pXLhv4;License: Standard YouTube License, CC-BY