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
Question
Chapter 6, Problem 8PE
Program Plan Intro
Implementation of a
Program Plan:
Write a C++ program with a main function and the required set of statements to accomplish the following:
- Prompts the user to enter a choice.
- Based on the choice the user will be able to enter the input.
- Accordingly, the output for area of rectangle, area of the circle and volume of cylinder will be displayed until the user enters -1.
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
Which of the following are true about looping statements?
(A It is a part of a computer program that makes code(s) repeat itself
(B It is also known as an iteration statement.
(c) An example of a looping statement is the if-else statement.
(D An example of a looping statement is the do-while statement.
(E) None of the other choices are correct.
Hi All,
Stuck on which programming loop to use for this question.
1.) A bug collector collects bugs every day for seven days. Design a program that keeps a running total of the number of bugs collected during the seven days. The loop should ask the user for the number of bugs collected for each day, and when the loops is finished, the program should display the total number of bugs collected.
All programming is in Python.
Please fix the errors in this program
Chapter 6 Solutions
C++ Programming: From Problem Analysis to Program Design
Ch. 6 - Mark the following statements as true or false:
a....Ch. 6 - Determine the value of each of the following...Ch. 6 - Determine the value of each of the following...Ch. 6 - Consider the following function definition. (4, 6)...Ch. 6 - Consider the following statements:
Which of the...Ch. 6 - Prob. 8SACh. 6 - Prob. 9SACh. 6 - Why do you need to include function prototypes in...Ch. 6 - Prob. 11SACh. 6 - Consider the following function: (4)...
Ch. 6 - Prob. 15SACh. 6 - What is the output of the following program? (4)
Ch. 6 - Write the definition of a function that takes as...Ch. 6 - Prob. 18SACh. 6 - How would you use a return statement in a void...Ch. 6 - Prob. 20SACh. 6 - Prob. 21SACh. 6 - What is the output of the following program?...Ch. 6 - Write the definition of a void function that takes...Ch. 6 - Write the definition of a void function that takes...Ch. 6 - Prob. 8PECh. 6 - The following formula gives the distance between...Ch. 6 - Write a program that takes as input five numbers...Ch. 6 - When you borrow money to buy a house, a car, or...Ch. 6 - Consider the definition of the function main:...Ch. 6 - The statements in the following program are not in...Ch. 6 - Write a program that outputs inflation rates for...Ch. 6 - Write a program to convert the time from 24-hour...Ch. 6 - Jason opened a coffee shop at the beach and sells...
Knowledge Booster
Similar questions
- Instructions: Use the C programming language. Do not use any other programming language like Python. Write one C file only for this problem. Only use variable declarations, assignments, operations, conditional constructs, and iterative constructs. Input should be taken in a value from the user (use scanf). Be sure to use loops to complete the solution. The use of functions is optional.arrow_forwardWhich of the following statements about Python expressions is true (choose all that apply). a. In mathematical expressions, the operand can be a mathematical expression itself. b. The assignment operator (-) has higher precedence than subtraction (-). c. To negate a value of a variable you use the (--) operator. d. In Python operators such (--) and (-) allow you to compare between values of different variables. Assuming that data is a correctly created list, then the fact that lists are mutable means that the following statement: data[9] max (data) / data[-3] %3D O a. Is illegal. O b. Maybe illegal if the list contains floats. Oc is fully correct. O d. Can be executed if and only if the list contains at least nine elements. O e. Can be executed if and only if the list contains at least 10 elements.arrow_forwardRead the following program and answer the questions given at the end.arrow_forward
- Please use if - then - else - end to write a Scilab program to do the following: After you enter an integer, I will tell you if the number is even or odd. Please enter an integer: 5 The number you entered is odd. Execution done. After you enter an integer, I will tell you if the number is even or odd. Please enter an integer: 8 The number you entered is even. Execution done. Hint: Use modulo() function to decide if a number is even or not.arrow_forwardA program is needed to monitor the user’s input and make sure that the text that was entered has balanced paranthesis. There are two types of paranthesis possible in the text: (a) The usual type which uses the symbols ( and ) (b) The square type which uses the symbols [ and ] Note that the text can also have spaces and the alpabet letters from a to z. Apply what you learned in this course (and especially in Chapters 5 and 7) to design a Nondeterministic Push-Down Automaton (NPDA) that can be used to parse the text and make sure that the paranthesis included in it are balanced and that every open paranthesis must be closed with the close paranthesis symbol. For example, the following text does not contain syntax errors and the NPDA should accept it and stop in a final state: The cat (which was running) jumped in to the (normal (although large)) hat. We should buy (in the case that [all are here] two large (bottles) of Coke). However the following text has a syntax error because the…arrow_forwardInstructions: Test each function with a sample output A. The following code in the function "is_prime" attempts to examine a number and return whether the number is prime (i.e. it has no factors besides 1 and itself). It has a "Boolean Flag" called 'prime', however, the boolean logic is not executed correctly, so the function won't always return the right/correct answer. # This function shows an incorrect code for determining whether an integer is prime.def is_prime(n):prime = Truefor i in range(2, n): if n % i == 0: prime = Falseelse: prime = Truereturn prime In what cases does the function report an incorrect answer? How can the code be fixed for it to always report the correct answer? Write your answers as "comments" B. Given the following list, write functions to generate the list comprehensions that would make the following new lists or tuples below function names (respectively): capitalize_first_letter, double_trouble, double_letter # index 0 1 2 3names =…arrow_forward
- PLEASE COMMENT ALL CODE Create a python program that checks whether a number is even or odd. Sample run: Even or Odd Checker Enter an integer: 33 This is an odd number. Specifications Store the code that gets user input and displays output in the main function. Store the code that checks whether the number is even or odd in a separate function. validate the use inputs, only integers accepted, give the user an option to enter again, ask the user if wants to try again.arrow_forwardFind the error (s) in each of the following program segments. Write the corrected statements and concisely explain how you corrected each.arrow_forwardQ1: Write a C# program that finds the value of Y from the following series: x2n+1 Y= x³ x5 x7 + 2! 3! + n! Note: for statement for outer loop and while statement for inner loops must be used. Don't use class. or functions - ...arrow_forward
- why is it showing error in this programarrow_forwardUse C++ Programming language. Amanda and Tyler opened a business that specializes in shipping liquids, such as milk, juice, and water, in cylindrical containers. The shipping charges depend on the amount of the liquid in the container. (For simplicity, you may assume that the container is filled to the top.) They also provide the option to paint the outside of the container for a reasonable amount. Write a program that does the following: Prompts the user to input the dimensions (in feet) of the container (radius of the base and the height). Prompts the user to input the shipping cost per liter. Prompts the user to input the paint cost per square foot. (Assume that the entire container including the top and bottom needs to be painted.) Separately outputs the shipping cost and the cost of painting. Your program must use the class cylinderType (designed in Programming Exercise 3) to store the radius of the base and the height of the container. (Note that 1 cubic feet = 28.32 liters or…arrow_forwardProgramming Exercise C++ Instructions : Write a program that outputs inflation rates for two successive years and whether the inflation is increasing or decreasing. Ask the user to input the current price of an item and its price one year and two years ago. To calculate the inflation rate for a year, subtract the price of the item for that year from the price of the item one year ago and then divide the result by the price a year ago. Your program must contain at least the following functions: a function to get the input; a function to calculate the results; a function to output the results. Use appropriate parameters to pass the information in and out of the function. An example of the program output is shown below: Enter the current price of the item: 10 Enter the price of the item one year ago: 8 Enter the price of the item two years ago: 4 Current year inflation: 0.25 Inflation one year ago: 1.00 Inflation is not increasing. Since your program handles currency, make sure to…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