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
Textbook Question
Chapter 5, Problem 5.14E
(Modified Compound-Interest
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
1)use two list one for names and one for cost
2) keep total cost you will spend and print the average cost for a gift -
????? could you do this with just one list???
3) after end of loop print the two list and the average and the number of name and number of cost in the list. (suggestion - use for loop)
USE this Program:
Holiday = []name = input("enter name").upper()while name != "XXX":cost = float(input("enter amount to spend >0 and <=10"))while cost <=0 or cost >10:print("invalid cost")cost = float(input("enter amount to spend >0 and <=10"))gift = name + " " + str(cost)Holiday.append(name)Holiday.append(cost)Holiday.append(gift)name = input("enter name").upper()print(Holiday)
Explain the body of the loop.
(Display patterns using loops) Use nested loops that display the following patterns in two separateprograms:
pattern A Pattern B Pattern c
123456 1 3
1 6 1 2 3 3 3
1 6 1 2 3 4 5 3 3 3
1 6 1 2 3 4 5 6 7 3 3
1 6 1 2 3 4 5 6 7 8 9 3
123456
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
The ____________ is always transparent.
Web Development and Design Foundations with HTML5 (9th Edition) (What's New in Computer Science)
Suppose that we create an array A of GameEntry objects, which has an integer scores field, and we clone A and s...
Data Structures and Algorithms in Java
While a program is running, a control is said to lose focus when the focus moves from that control to another c...
Introduction To Programming Using Visual Basic (11th Edition)
Type in and run the six programs presented in this chapter. Compare the output produced by each program with th...
Programming in C
Convert each of the following binary representations to its equivalent base ten form: a. 101010 b. 100001 c. 10...
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
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
- 10) Write a program that calculates and returns the sum of 1 to n in steps of 2, where n is an argument passed to the function. For example, if 11 is passed, it will return 1 + 3 + 5 + 7+9 + 11. Do this using for loop.arrow_forwardiii) In the Python language, write a program to find the sum of all odd natural numbers less than 200. Use a for in range loop to find the sum.arrow_forwardProblem3: Looping: (30 points)Create a program flowchart that generates and displays the Fibonacci sequencenumbers of n(as input). In Fibonacci, the current third number is the sum of two previousnumbers. Sample input/output dialogue:Enter a no. 9Fibonacci series : 1 1 2 3 5 8 13 21 34Your flowchart and pseudocode here…...pls help me :(arrow_forward
- Q2) Answer only two A- Using for loops, write a program to find and print the result of: +cc 2 4 6 8 + X² 4.6 1.8 Enter (x) value from the keyboard. B- Using for loop, write a program to calculate the average of the numbers from (1-100) exclude the number (84) from the average. C- Write program to enter infinite number of integers from the keyboard. the program should stop if we enter number 5. + +arrow_forwardPrlda..arrow_forwardI need help plsarrow_forward
- (8) Write a while loop that displays the square of the natural numbers 1, 2,3,...arrow_forwardQ1: A. Develop an M-file that input the n value in to a function and display the value of R as a R= 1² +2²+3² ............. n term result. B. Write Matlab code to keep asking for a number until you enter a negative number, using While loop Structure. C. Use a switch statement to rewrite the following code segment x = 1; a = 3; if(a == 1) x = x+5; elseif (a== 2) x = x+10; elseif (a == 3) x = x+16; else x = x+34; end disp(x);arrow_forwarda) Rewrite the following line using the while loop! for ( int x = 0; x <10; x + = 2) printf (“5”) ; b) using the switch structure , the number 25, Pressing 1 makes 25%,Pressing 2 will double it,When 3 is pressed, the remainder of the section with 3,If a numeric key other than 1, 2, 3 is pressed, 'Wrong selection!' Write a program to print. The screen outputs of the program should be as follows!arrow_forward
- python codingarrow_forward(python) Study the following code, specifically the loop. _sum = 10 for k in range (2, 20, 3): _sum = _sum + (2*k) if _sum > 100: print("exceeded 100") Now, rewrite the for loop (for k in range(2, 20, 3):)to be a while loop that accomplishes the same objective. You don't need to show/use the other lines.arrow_forwardWrite X Program to input the temperatures of muscat for each day of the month of december and calculate and display the average temperature (used for loop) (december has 31 days)arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- 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
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Control Structures - while loop - do-while loop - for loop - Goto - break - continue statements; Author: EzEd Channel;https://www.youtube.com/watch?v=21l11_9Osd0;License: Standard YouTube License, CC-BY