Concept explainers
(You need to do Practice Programs 4 and 7 before doing this one.) Write a
Notice that your program will have if-else Statements embedded inside of if-else statements, but only in an indirect way. The outer if-else statement will include two function calls as its two branches. These two function calls will each in turn include an if-else statement, but you need not think about that. They are just function calls and the details are in a black box that you create when you define these functions. If you try to create a four-way branch, you are probably on the wrong track. You should only need to think about two-way branches (even though the entire program does ultimately branch into four cases). Include a loop that lets the user repeat this computation for new input values until the user says he or she wants to end the program.
Want to see the full answer?
Check out a sample textbook solutionChapter 5 Solutions
Problem Solving with C++ (10th Edition)
Additional Engineering Textbook Solutions
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Web Development and Design Foundations with HTML5 (8th Edition)
Java: An Introduction to Problem Solving and Programming (8th Edition)
Computer Systems: A Programmer's Perspective (3rd Edition)
Software Engineering (10th Edition)
Starting Out with C++: Early Objects (9th Edition)
- Part 4: For circle, square and annulus write a program to find the area, perimeter (or circumference) for a range of parametric values given by the user and plot the corresponding shapes in the range given. User needs to identify lower and upper values of each parameter. The identified range for the parameters should be then divided into 10 monotonic steps inside your program. Accordingly, you need to calculate the values and plot the shapes corresponding to all 10 values in the range identified by the user. The program should plot the geometries in the first quadrant.arrow_forward17. Redo Programming Exercise 16 so that the user can also input the cost of producing one liter of milk and the profit on each carton of milk.arrow_forwardHOMEWORK 6: The tank in a water tower has the geometry shown in the figure below (the lower part is a cylinder and the upper part is an inverted frustum cone). Inside the tank there is a float that indicates the level of the water. Write a code that determines the volume of the water in the tank from the position (height h) of the float. The input of the function is the value of h in meter, and the output is the volume of the water in m?. diameter 46 m 14 m 19 m diameter 25 m Vrustum cone =1(h – 19) × (12.5² + 12.5 × m + rỉ) Vcylinder = T X 12.52 x 19 10.5 Th = 12.5 + (h – 19) 14arrow_forward
- Hello, I was wondering if I could get help with this. The language I am using is Pythonarrow_forwardComplete the following program. An object floats in any fluid, if the density of the object is lower than the density of the fluid. Write a program to determine whether an object will float in the oil where the density of oil is 0.92 g/cm³. The program will read mass and volume of an object then computes its density and determines whether the object will float. Program consists of two functions as follows: void input(. .): This function with two pass by reference parameters, reads mass and volume of an object from the user. string process(. ..): This function receives mass and volume, computes the desnity of the object using formula as shown below: density=mass / volume If the density of the object is higher than the density of oil, it will return the string "Float", if the density of the object and the oil is equal then it returns a string "Stay at some place" otherwise it will return "Submerge". main () program is given below and you are asked to write the function definitions in the…arrow_forwardMATLAB The Mach number is a critical quantity in aerodynamics. It is the ratio of the speed of an object (e.g., an aircraft) to the speed of sound. If the Mach number is less than 1, the flow is subsonic; if the Mach number is between (0.8-1.2), the flow is transonic; if the Mach number is equal to 1, the flow is sonic; if the Mach number is between (1.2 and 5), the flow is supersonic; if the Mach number is greater than 5, the flow is hypersonic. Write a script that will prompt the user for the speed of an aircraft and the speed of sound at the aircraft's current altitude and will print whether the condition is subsonic, transonic, sonic, supersonic or hypersonic.arrow_forward
- Please use Visual Studios coding in Python. (Use Python 3 Version)arrow_forwardQ4: the volume of a cylinder is given by the formula: V=r r2L Where r is the cylinder's radius and L is its length. Using the above formula; write a program that uses a function which accepts a cylinder's radius and length as parameters and returns its volume.arrow_forwardI am having issues on trying to get the profit this is the question- In the ChiliToGo program in Exercise 12, the costs to produce an adult meal and a child’s meal are $4.35 and $3.10, respectively. Adult meals are sold for $7 and children's meals are sold for $4. Modify the ChiliToGo program to display the total profit for each type of meal as well as the grand total profit. This is what code it starts with- import java.util.Scanner; class ChiliToGoProfit { public static void main(String[] args) { // Modify the code below final double ADULT_PRICE = 7; final double CHILD_PRICE = 4; int adultMeals; int childMeals; double totalAdult, totalChild, grandTotal; Scanner input = new Scanner(System.in); System.out.print("Enter number of adult meals ordered >> "); adultMeals = input.nextInt(); System.out.print("Enter number of child meals ordered >> "); childMeals = input.nextInt(); totalAdult = adultMeals *…arrow_forward
- Use C++ Codingarrow_forward1.Write program to iteratively compute Fibonacci numbers (named after an Italian mathematician).Some Fibonacci numbers are 1, 1, 2, 3, 5, 8, ... where the next number is found by summing the preceding two numbers. Your program will read in a number, like 7, report the first 7 numbers. in this case1,1,2,3,5,8,13. Your program is not assured of receiving good data, thus if -2 is received as the number of numbers, then an error should be reported.arrow_forwardCreate code for this. (C language only)arrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning