Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

Requirements for the program include: Name the C/C++ file with the following format: LastNameFirstNameUnit1 cpp. For example the Instructor may create a file with the

Requirements for the program include:

  1. Name the C/C++ file with the following format: LastNameFirstNameUnit1cpp. For example the Instructor may create a file with the following name: TonsmannGuillermoUnit1.cpp.
  2. Select appropriate identifiers and data types for all variables. Declare all of them correctly.
  3. The input variables are top radius of the spherical segment (a), the bottom radius of the spherical segment (b), and the height of the spherical segment (h). All input values for these variables must be read from the user using scanf. These values must be printed after received, with appropriate labels to identify them. This will confirm that the values were properly read.
  4. Evaluate the requested formulas and store their results in output variables.
  5. Print the values for output variables after evaluation, with appropriate labels.
  6. Include appropriate comments. In particular include a header for the main function and description of all variables.
  7. The program should compile and run.

Directions

Write a C/C++ program to calculate the following formulas that describe the dimensions of a spherical segment (shown):

image text in transcribed

  1. Volume=16h(3a2+3b2+h2)
  2. TopSurfaceArea=a2
  3. BottomSurfaceArea=b2
  4. SphereRadius=R=((ba)2+h2)((a+b)2+h2)4h2
  5. LateralSurfaceArea=2Rh

Some formulas require the value of . You may use the value of 3.14159265359 for this constant. Other formulas include a power of two of a variable, for example h2. To evaluate this, all you must do is to multiply the variable by itself (h*h). On the other hand, to evaluate the square root of a variable, you may use the sqrt function. This function requires you to include the math.h C library at the beginning of the program, like this:

#include

To calculate the square root of variable h you should write; sqrt(h)

Do not use Arrays or any other advanced concept that was not reviewed in the class yet to solve this assignment. Assignments that use these concepts will only be granted 1 point for presentation.

Example

The program should reproduce the following input-output session:

What is the size of the top radius of the spherical segment? 10 What is the size of the bottom radius of the spherical segment? 20 What is the size of the height of the spherical segment? 10 The data your entered is: The top radius of the spherical segment is 10.00. The bottom radius of the spherical segment is 20.00. The height of the spherical segment is 10.00. With this data you have the following results: The volume of the spherical segment is 8377.58. The top surface area of the spherical segment is 314.16. The bottom surface area of the spherical segment is 1256.64. The sphere radius of the spherical segment is 22.36. The lateral surface area of the spherical segment is 1404.96.
h. a. ALR b

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image
Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Records And Database Management

Authors: Jeffrey R Stewart Ed D, Judith S Greene, Judith A Hickey

4th Edition

0070614741, 9780070614741

More Books

Students explore these related Databases questions