EBK C++ PROGRAMMING: FROM PROBLEM ANALY
8th Edition
ISBN: 9781337514491
Author: Malik
Publisher: CENGAGE LEARNING - CONSIGNMENT
expand_more
expand_more
format_list_bulleted
Concept explainers
Expert Solution & Answer
Chapter 1, Problem 17SA
Explanation of Solution
Algorithm step | C++ instruction (code) |
Get the radius | cin >> radius ; |
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
The volume of a sphere is (4.0/3.0)πr 3 and the surface area is 4.0πr 2, where r is the radius of the sphere. Given the radius, design an algorithm that computes the volume and surface area of the sphere. Also using the C++ statements provided for Example 1-1, write the C++ statement corresponding to each statement in the algorithm. (You may assume that π = 3.141592.)
The volume of a sphere is (4.0 / 3.0)pr3 and the surface area is 4.0pr2, where r is the radius of the sphere. Given the radius, design an algorithm that computes the volume and surface area of the sphere. Also using the C++ statements provided for Example 1-1, write the C++ statement corresponding to each statement in the algorithm. (You may assume that p = 3.141592.)
Computer Science
You have been given a flat cardboard of area,
say, 70 square inches to
make an open box by cutting a square from
each corner and folding the sides (see Figure
below). Your objective is to determine the
dimensions, that is, the length and width, and
the
side of the square to be cut from the corners so
that the resulting box is of maximum length.
Write a C++ program that prompts the user to
enter the area of the flat cardboard. The
program then outputs the length and width of
the cardboard and the length of the side of the
square to be cut from the corner so that the
resulting box is of maximum volume. Calculate
your answer to three decimal places. Your
program must contain a function that takes as
input
the length and width of the cardboard and
returns the side of the square that should be cut
to
maximize the volume. The function also returns
the maximum volume.
Chapter 1 Solutions
EBK C++ PROGRAMMING: FROM PROBLEM ANALY
Ch. 1 - 1. Mark the following statements as true or...Ch. 1 - Prob. 2SACh. 1 - Prob. 3SACh. 1 - Prob. 4SACh. 1 - Prob. 5SACh. 1 - Prob. 6SACh. 1 - In a C++ program, preprocessor directives begin...Ch. 1 - Prob. 8SACh. 1 - Prob. 9SACh. 1 - Prob. 10SA
Ch. 1 - Prob. 11SACh. 1 - Prob. 12SACh. 1 - Design an algorithm to find the weighted average...Ch. 1 - Prob. 14SACh. 1 - Prob. 15SACh. 1 - 16. The dealer’s cost of a car is 85% of the...Ch. 1 - Prob. 17SACh. 1 - 18. Tom and Jerry opened a new lawn service. They...Ch. 1 - 19. Jason typically uses the Internet to buy...Ch. 1 - Prob. 20SACh. 1 - Prob. 21SACh. 1 - A student spends a majority of his weekend playing...Ch. 1 - You are given a list of students names and their...
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
- (Data processing) Years that are evenly divisible by 400 or are evenly divisible by 4 but not by 100 are leap years. For example, because 1600 is evenly divisible by 400, 1600 was a leap year. Similarly, because 1988 is evenly divisible by 4 but not by 100, it was also a leap year. Using this information, write a C++ program that accepts the year as user input, determines whether the year is a leap year, and displays a message telling the user whether the entered year is or is not a leap year.arrow_forward(Acoustics) The loudness of a sound is measured in units of decibels and is calculated as shown: 10LOG(SL/RL) SL is the intensity of the sound being measured. RL is a reference sound-intensity level. Using this formula, write a C++ program that calculates and displays the decibel loudness of a busy street having a sound intensity of 10,000,000 RL. Verify your program’s result by doing a hand calculation. After verifying that your program is working correctly, use it to determine the sound level in decibels of the following sounds: a.Awhisperatsoundintensity200RLb.Arockbandplayingatsoundintensity1,000,000,000,000RLc.Anairplanetakingoffatsoundintensity100,000,000,000,000RLarrow_forwardThe volume, V, of a box is given by the formula V where L is the box’s length, W is the box’s width and H is the box’s height. Use this information to write a complete C++ program that asks the user to enter 10 values of box’s length, box’s width and box’s higth measurements, one at a time, and then the program calculates for each value entered the Volume of a box Using a for loop.arrow_forward
- The volume, V, of a box is given by the formula V where L is the box’s length, W is the box’s width and H is the box’s height. Use this information to write a complete C++ program that asks the user to enter 10 values of box’s length, box’s width and box’s higth measurements, one at a time, and then the program calculates for each value entered the Volume of a box Using a for loop.arrow_forwardThe language is C++ 3. Write a program to calculate the factorial value of the inputnumber.Use the incrementation formula for your solution instead ofdecrementation formula. Apply the three looping statements foryour solution.Enter a No : 4Factorial value : 24arrow_forwardUsing c programming, write a source code that determine if the integer is a prime number or not. Note that if the integer is not a prime number the program should show the divisible of it and if it is a prime the program should also show the divisible of it (basis on the given picture). Attach the source code you make below.arrow_forward
- A triangular number or triangle number counts the objects that can form an equilateral triangle. The nth triangle number is the number of dots or balls in a triangle with n dots on a side; it is the sum of the n natural numbers from 1 to n.Mathematically, the nth triangular number Tn is defined as: Tn=n(n+1)/2Write a C++ program that: reads a positive integer k from the user. If the user enters a negative value, then the program should continue prompting until he/she enters a positive integer value. Then, the program should compute a series of first k triangular number and displaythem as illustrated in the sample output. Also the program will count how many ODD and EVEN triangular numbers in the series(respectively) and display it as illustrated in the sample output. Finally, the program will compute and sum up the members of the series and display the result as illustrated in the sample output.The program must use at least two functions as following:1. A function to compute the…arrow_forwardUsing C++arrow_forwardUsing the formula below which calculates the distance between two points, (x1, y1) and (x2, y2) in the Cartesian plane: Sqrt ( (x2-x1)2 + (y2-y1)2 ) where sqrt represents square root This formula can be used to find the radius of the circle given a centre and a point on the cicle. Write an interactive C program that prompts the user to enter a point on the circle and the centre. The program should then output the circumference, area, diameter and circle’s radius. Your program must have at least the following functions: i)area: This function takes as its parameter a number that represents the radius of the circle and returns the circle’s area. (If r is the radius, the area is πr2.) Assume that π = 3.1416. ii)circumference: This function takes as its parameter a number that represents the radius of the circle and returns the circle’s circumference. (If r is the radius, the circumference is 2πr.) iii)radius: This function takes as its parameters 4 numbers that represent a…arrow_forward
- Note:solution using c++ language Pre-Lab 02: Write a C++ program to calculate a GPA for the user. The program should enter letter grades until any letter other than A, B, C, D, or F is entered. The average should be calculated and printed according to the following: A (or a) = 4.0 B (or b) = 3.0 C (or c) = 2.0 D (or d) = 1.0 F (or f) = 0.0 Use a do..while loop.arrow_forwardwrite c++arrow_forwardUSING SWITCH CASE make a c++ program that generates a plate number based on the user’s answer to the following questions: 1. What is your favorite color of the rainbow (ROYGVIB)? a. Use the first letter of the chosen color as the first character of the plate number. b. Display “Invalid Input” and ask the user to re-enter his/her answer if the answer is not a valid color of the rainbow. 2. What is your month of birth? a. Use the last letter of the month as the second character of the plate number. b. Display “Invalid Input” and ask the user to re-enter his/her answer if the answer is not a valid month. 3. What is your first name? a. Use the third letter of the first name as the third character of the plate number. No need to include the second name if you have a second name. Make sure to use “cout” and “cin” to collect the necessary inputs from the user. For the number section: 1. Ask the user his/her age and use the age as the first and second digits of the plate number. a. Display…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 Ptr
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr