1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Bingel [31]
4 years ago
15

After having done the hand calculation and pseudocode for a program that models inflating a spherical balloon, now implement the

task in Java. Remember, first the balloon is inflated to have a certain diameter (which is provided as an input). Then you inflate the balloon so that the diameter grows by an inch, and display the amount the volume has grown. Repeat that step: grow the diameter by another inch and show the growth of the volume.
Engineering
1 answer:
vampirchik [111]4 years ago
7 0

Answer:

Explanation:

CODE :

import java.util.Scanner; // required imports for the class

class Balloon { // class to run the code

public static void main(String[] args) { // driver method

Scanner in = new Scanner(System.in); // scanner class to get the data

System.out.print("Diameter: "); // message

double diameter = in.nextDouble(); // prompt

double growth = 1; // local variables

int c = 0;

while (c < 10) { // iterate over the loop

double radius = diameter / 2; // calculate the radius

double vol = ((double)4 / 3) * 3.14 * radius * radius * radius; // calculate the initial volume

diameter = growth + diameter; // update the diamter

System.out.printf("\nIncrease in the Diameter is : %.0f", growth); // message

System.out.println("\nNew Diameter is : " + diameter); // print the diameter

radius = diameter / 2; // calculate the new diameter

double growthvol = ((double)4 / 3) * 3.14 * radius * radius * radius; // calculate the new volume

System.out.printf("Increase in the Volume is : %.0f", growthvol - vol); // message

System.out.println("\nNew Volume is : " + growthvol); // message

c++; // increment the count

}

}

}

OUTPUT :

run 1 :

Diameter: 10

Increase in the Diameter is : 1

New Diameter is : 11.0

Increase in the Volume is : 173

New Volume is : 696.5566666666667

Increase in the Diameter is : 1

New Diameter is : 12.0

Increase in the Volume is : 208

New Volume is : 904.3199999999998

Increase in the Diameter is : 1

New Diameter is : 13.0

Increase in the Volume is : 245

New Volume is : 1149.7633333333333

Increase in the Diameter is : 1

New Diameter is : 14.0

Increase in the Volume is : 286

New Volume is : 1436.0266666666666

Increase in the Diameter is : 1

New Diameter is : 15.0

Increase in the Volume is : 330

New Volume is : 1766.25

Increase in the Diameter is : 1

New Diameter is : 16.0

Increase in the Volume is : 377

New Volume is : 2143.5733333333333

Increase in the Diameter is : 1

New Diameter is : 17.0

Increase in the Volume is : 428

New Volume is : 2571.1366666666668

Increase in the Diameter is : 1

New Diameter is : 18.0

Increase in the Volume is : 481

New Volume is : 3052.08

Increase in the Diameter is : 1

New Diameter is : 19.0

Increase in the Volume is : 537

New Volume is : 3589.5433333333335

Increase in the Diameter is : 1

New Diameter is : 20.0

Increase in the Volume is : 597

New Volume is : 4186.666666666667

run 2 :

Diameter: 7.5

Increase in the Diameter is : 1

New Diameter is : 8.5

Increase in the Volume is : 101

New Volume is : 321.39208333333335

Increase in the Diameter is : 1

New Diameter is : 9.5

Increase in the Volume is : 127

New Volume is : 448.6929166666667

Increase in the Diameter is : 1

New Diameter is : 10.5

Increase in the Volume is : 157

New Volume is : 605.82375

Increase in the Diameter is : 1

New Diameter is : 11.5

Increase in the Volume is : 190

New Volume is : 795.9245833333334

Increase in the Diameter is : 1

New Diameter is : 12.5

Increase in the Volume is : 226

New Volume is : 1022.1354166666666

Increase in the Diameter is : 1

New Diameter is : 13.5

Increase in the Volume is : 265

New Volume is : 1287.59625

Increase in the Diameter is : 1

New Diameter is : 14.5

Increase in the Volume is : 308

New Volume is : 1595.4470833333332

Increase in the Diameter is : 1

New Diameter is : 15.5

Increase in the Volume is : 353

New Volume is : 1948.8279166666664

Increase in the Diameter is : 1

New Diameter is : 16.5

Increase in the Volume is : 402

New Volume is : 2350.87875

Increase in the Diameter is : 1

New Diameter is : 17.5

Increase in the Volume is : 454

New Volume is : 2804.7395833333335

Description :

During the casting or the calculation of the volume and the radius the RHS needs to be casted for the numerator with the double datatype so as to clearly get the result. And that the formula is also been updated.

Hope this is helpful.

You might be interested in
Which of the following statements are true of computer hardware engineers?
9966 [12]

Answer:

you never mentioned the options

3 0
4 years ago
11) 6x^2-49x - 45<br> What is the factored answer to this trinomial
Lady bird [3.3K]
Factores is (6x+5)(x-9)
3 0
3 years ago
Which test element is used to apply test execution settings for the main business flow excluding Login and Log out 1) Run time c
Svet_ta [14]

Test element is used to apply test execution settings for the main business flow excluding Login and Log out is "Transaction  controller"

<u>Explanation:</u>

Transaction controllers are a technoscientifically kind of controllers that produce an additional sample that measures the overall time is taken or response time to perform its nested samplers.

The Controller has two checkboxes,those are

1.Generate Parent Samples

2. Include term of the timer and pre-post processors in the produced sample - It is the time which involves all processing samples within the Transaction controller, not just the HTTP samples. In Case one sample is lost or crashed then the entire Transaction Controller will fail. In case anyone sample assertion is failed then the complete Transaction Controller will fail.

3 0
4 years ago
The thrust F of a screw propeller is known to depend upon the diameter d,speed of advance \nu ,fluid density p, revolution per s
musickatia [10]

Answer:

<em>screw thrust = ML</em>T^{-2}<em> </em>

Explanation:

thrust of a screw propeller is given by the equation = pV^{2}D^{2} x \frac{ND}{V}Re

where,

D is diameter

V is the fluid velocity

p is the fluid density

N is the angular speed of the screw in revolution per second

Re is the Reynolds number which is equal to  puD/μ

where p is the fluid density

u is the fluid velocity, and

μ is the fluid viscosity = kg/m.s = ML^{-1}T^{-1}

<em>Reynolds number is dimensionless so it cancels out</em>

The dimensions of the variables are shown below in MLT

diameter is m = L

speed is in m/s = LT^{-1}

fluid density is in kg/m^{3} = ML^{-3}

N is in rad/s = LL^{-1}T^{-1} =

If we substitute these dimensions in their respective places in the equation, we get

thrust = ML^{-3}(LT^{-1}) ^{2}L^{2}\frac{T^{-1} L}{LT^{-1} }

= ML^{-3}L^{2}T^{-2}

<em>screw thrust = ML</em>T^{-2}<em> </em>

This is the dimension for a force which indicates that thrust is a type of force

6 0
3 years ago
<img src="https://tex.z-dn.net/?f=%20%5Ctt%20%7BWhat%5C%3A%20%5C%3A%20is%20%5C%3A%20%5C%3A%20inline%5C%3A%20%5C%3A%20function%20
Mila [183]
<h3 /><h3>\huge \bf༆ Answer ༄</h3>

What is a function ?

An expression or rule that defines a relationship between two variables [ one independent and other dependent variable ]

for example ~

y = x² is a function, where y is a dependent variable and x is independent variable.

This function is used to find squares and numbers ~

5 0
3 years ago
Read 2 more answers
Other questions:
  • The gear with the least number of teeth is called the
    11·1 answer
  • Explain different types of loads on beam with sketch
    8·1 answer
  • What are four types of biomass that can be converted into alternative fuels
    9·1 answer
  • Cuáles son los sentidos comunes que se pueden utilizar, para identificar un metal, gases o líquido
    7·1 answer
  • Which professional draws maps and plans for projects involving structures other than buildings, such as bridges?
    13·2 answers
  • What is the range of a 32-bit unsigned integer?
    15·1 answer
  • What is An ampere is
    15·2 answers
  • What is the most common type of suspensions system used on body over frame vehicles?
    15·1 answer
  • Drag each label to the correct location on the chart. Classify the organisms based on how they obtain food.
    14·2 answers
  • The A-36 steel drill shaft of an oil well extends 12 000 ft into the ground. Assuming that the pipe used to drill the well is su
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!