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
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
C++ Programming: From Problem Analysis to Program Design
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 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_forward
- How can i find the number of days of a given month for a year. You may take user input for month and year and print the number of days. In c#arrow_forwardA 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_forward
- can anyone help..pleasearrow_forward幻令ll イ1:EY 9051aa5b780a24e112042a7f3fd8fe... 5 من 7 Homework 3: Write a program in c language to calculate two real numbers. The operation you are going to used are "add, subtract, multiple and division" and it is going to be optional to calculate the two numbers separately at each time you are going to execute the program. After you execute the program separately at each time your run the program the output look like below: Al-Fa amine Methedel Enter Enter Enter Enter + to add betveen tuo nunbers - to subtract betueen tuo nunbers - to multiply betueen tuo nunbers / to divide betveen tuo nunbers Enter the operat ion i+ Enter the ist nunher :2.3 Enter the 2nd nunber :5.6 The result is 7.900 Press any key to cont inue. - OR Enter Enter Enter Enter • ta add hetueen tuo nunbers - to subtract betueen tuo nunbers - to nultiply betnen tuo I to diuide betueen tuo nunbers Enter the operation :- Enter the ist nunber :2.3 Enter the 2nd nunber 15.6 The result is -3.308 Press any key to contarrow_forwardplease help me solve this problem the language is C++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