Write an interactive program to calculate the volume and surface area of a three-dimensional object.

Answers

Answer 1

Answer:

I am writing a Python program:

pi=3.14 #the value of pi is set to 3.14

radius = float(input("Enter the radius of sphere: ")) #prompts user to enter the radius of sphere

surface_area = 4 * pi * radius **2 #computes surface area of sphere

volume = (4.0/3.0) * (pi * radius ** 3) #computes volume of sphere

print("Surface Area of sphere is: ", surface_area) #prints the surface area

print("Volume of sphere is: {:.2f}".format(volume)) #prints the volume        

Explanation:

Please see the attachment for the complete interactive code.

The first three lines of print statement in the attached image give a brief description of the program.

Next the program assigns 3.14 as the value of π (pi). Then the program prompts the user to enter the radius. Then it computes the surface area and volume of sphere using the formulas. Then it prints the resultant values of surface area and volume on output screen.

The psuedocode for this program is given below:

PROGRAM SphereVolume

pi=3.14

NUMBER radius, surface_area, volume  

INPUT radius

COMPUTE volume = (4/3) * pi* radius ^3

COMPUTE surface_area = 4 * pi * radius ^ 2

OUTPUT volume , surface_area

END

Write An Interactive Program To Calculate The Volume And Surface Area Of A Three-dimensional Object.

Related Questions

Cloud computing gives you the ability to expand and reduce resources according to your specific service requirement.

a. True
b. False

Answers

Answer:

a. True

Explanation:

Cloud computing can be defined as a type of computing that requires shared computing resources such as cloud storage (data storage), servers, computer power, and software over the internet rather than local servers and hard drives.

Generally, cloud computing offers individuals and businesses a fast, effective and efficient way of providing services.

In Computer science, one of the most essential characteristics or advantages of cloud computing is rapid elasticity.

By rapid elasticity, it simply means that cloud computing gives you the ability to expand and reduce resources according to your specific service requirement because resources such as servers can be used to execute a particular task and after completion, these resources can then be released or reduced.

Some of the examples of cloud computing are Google Slides, Google Drive, Dropbox, OneDrive etc.

A machine on a 10 Mbps network is regulated by a token bucket algorithm with a fill rate of 3 Mbps. The bucket is initially filled to capacity at 3MB. How long can the machine transmit at the full 10 Mbps capacity

Answers

2+4= this gbhfchgcjdxbhdch is correct

Consider the following calling sequences and assuming that dynamic scoping is used, what variables are visible during execution of the last function called? Include with each visible variable the name of the function in which it was defined.a. Main calls fun1; fun1 calls fun2; fun2 calls fun3b. Main calls fun1; fun1 calls fun3c. Main calls fun2; fun2 calls fun3; fun3 calls fun1d. Main calls fun3; fun3 calls fun1e. Main calls fun1; fun1 calls fun3; fun3 calls fun2f. Main calls fun3; fun3 calls fun2; fun2 calls fun1void fun1(void);void fun2(void);void fun3(void);void main() {Int a,b,c;…}void fun1(void){Int b,c,d;…}void fun2(void){Int c,d,e;…}void fun3(void){Int d,e,f;…}

Answers

Answer:

In dynamic scoping the current block is searched by the compiler and then all calling functions consecutively e.g. if a function a() calls a separately defined function b() then b() does have access to the local variables of a(). The visible variables with the name of the function in which it was defined are given below.

Explanation:

In main() function three integer type variables are declared: a,b,c

In fun1() three int type variables are declared/defined: b,c,d

In fun2() three int type variables are declared/defined: c,d,e

In fun3() three int type variables are declared/defined: d,e,f

a. Main calls fun1; fun1 calls fun2; fun2 calls fun3

Here the main() calls fun1() which calls fun2() and fun2() calls func3() . This means first the func3() executes, then fun2(), then fun1() and last main()

Visible Variable:  d, e, f        Defined in: fun3

Visible Variable: c                 Defined in: fun2 (the variables d and e of fun2  

                                                                                                     are not visible)

Visible Variable: b                  Defined in: fun1 ( c and d of func1 are hidden)

Visible Variable: a                 Defined in: main (b,c are hidden)

b. Main calls fun1; fun1 calls fun3

Here the main() calls fun1, fun1 calls fun3. This means the body of fun3 executes first, then of fun1 and then in last, of main()

Visible Variable: d, e, f           Defined in: fun3

Visible Variable:  b, c              Defined in: fun1 (d not visible)

Visible Variable:  a                  Defined in: main ( b and c not visible)

c. Main calls fun2; fun2 calls fun3; fun3 calls fun1

Here the main() calls fun2, fun2 calls fun3 and fun3 calls fun1. This means the body of fun1 executes first, then of fun3, then fun2 and in last, of main()

Visible Variable:  b, c, d        Defined in: fun1

Visible Variable:  e, f             Defined in: fun3 ( d not visible)

Visible Variable:  a                Defined in: main ( b and c not visible)

Here variables c, d and e of fun2 are not visible

d. Main calls fun3; fun3 calls fun1

Here the main() calls fun3, fun3 calls fun1. This means the body of fun1 executes first, then of fun3 and then in last, of main()

Visible Variable: b, c, d     Defined in: fun1  

Visible Variable:   e, f        Defined in:  fun3   ( d not visible )

Visible Variable:    a          Defined in: main (b and c not visible)

e. Main calls fun1; fun1 calls fun3; fun3 calls fun2

Here the main() calls fun1, fun1 calls fun3 and fun3 calls fun2. This means the body of fun2 executes first, then of fun3, then of fun1 and then in last, of main()

Visible Variable: c, d, e        Defined in: fun2

Visible Variable:  f               Defined in: fun3 ( d and e not visible)

Visible Variable:  b               Defined in:  fun1 ( c and d not visible)

Visible Variable: a                Defined in: main ( b and c not visible)

f. Main calls fun3; fun3 calls fun2; fun2 calls fun1

Here the main() calls fun3, fun3 calls fun2 and fun2 calls fun1. This means the body of fun1 executes first, then of fun2, then of fun3 and then in last, of main()

Visible Variable: b, c, d       Defined in: fun1  

Visible Variable: e               Defined in: fun2  

Visible Variable: f                Defined in: fun3  

Visible Variable: a               Defined in: main

Other Questions
Summa Theologica discusses all of these topics except _____. Alpha Industries is considering a project with an initial cost of $9.1 million. The project will produce cash inflows of $1.84 million per year for 7 years. The project has the same risk as the firm. The firm has a pretax cost of debt of 5.94 percent and a cost of equity of 11.49 percent. The debtequity ratio is .71 and the tax rate is 40 percent. What is the net present value of the project? Please I need help with this How to convert 2cm to feet? Which sentence uses the modifier correctly?A The vacationers saw many jellyfish snorkeling.B They listened to the songs whales make at Renata's house.C While racing for the train, the hat flew off myhead.D After revising the essay, I received a good grade. Simplify cos^2theta(1+ tan^2theta) please help me.... The question no.b and would like to request you all just give me correct answer. Your textbook discussed a model of a simple economy with four markets: labor, capital, energy, and food. Which of the following statements is inconsistent with a general equilibrium for this simple economy?A. The household demand for energy equals the industry supply of energy. B. The household demand for food equals the industry supply of food. C. The household demand for labor equals the industry supply of labor. D. The household supply of capital equals the industry demand for capital. As the workforce becomes more diverse, why does performance appraisal become a more difficult process? [tex]\frac{63,75660}{705,280}[/tex] whats the equation of line ? y =__x + __ Difference between switch case and if else statement. how many are 4 raised to 4 ??? A watermelon weighs 6.45 kilograms. How many grams does the watermelon weigh? Nancy, aged 70, has a vacant plot adjacent to her house that she intends to bequeath to her grandson Roy upon her death. However, an important railroad project is being undertaken nearby and the local authorities have informed Nancy that the new railroad will cover her vacant lot. They have also promised her fair compensation in return. Can the government take her property? Question #4: Read the run-on sentence. The squirrel ran up the tree he was hiding nuts. Which is the best way to rewrite the run-on sentence? A.The squirrel ran up the tree. He was hiding nuts. B.The squirrel ran up the tree he was hiding. Nuts. C.The squirrel ran up. The tree he was hiding nuts. D.The squirrel ran up. The tree he was hiding nuts. an object weights 0.250 kgf in air 0.150 in water and 0.125 in an oil.find out the density of the object and the oil What is the only source of energy production for RBCs? Os subnveis mais energticos de um dado tomo so: ...4s2 3d10 4p5 a) indique o seu nmero atomico b) quantos electres de valncia apresenta esse tomo c) a que famlia pertence? Identify two prices indices?