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
g a heat engine is located between thermal reservoirs at 400k and 1600k. the heat engine operates with an efficiency that is 70%
Bond [772]

Answer:

<em>Heat rejected to cold body = 3.81 kJ</em>

Explanation:

Temperature of hot thermal reservoir Th = 1600 K

Temperature of cold thermal reservoir Tc = 400 K

<em>efficiency of the Carnot's engine = 1 - </em>\frac{Tc}{Th}<em> </em>

eff. of the Carnot's engine = 1 - \frac{400}{600}

eff = 1 - 0.25 = 0.75

<em>efficiency of the heat engine = 70% of 0.75 = 0.525</em>

work done by heat engine = 2 kJ

<em>eff. of heat engine is gotten as = W/Q</em>

where W = work done by heat engine

Q = heat rejected by heat engine to lower temperature reservoir

from the equation, we can derive that

heat rejected Q = W/eff = 2/0.525 = <em>3.81 kJ</em>

6 0
3 years ago
Solid rockets can experience significant 2 phase flow. a) True b) False
dezoksy [38]

Answer:

the answer is false solid rockets can experience significant 2 phase flow

8 0
3 years ago
Which of the following are examples of engineering controls? Select all that apply.
Neporo4naja [7]

The examples of engineering controls is Biohazard waste containers and Spill clean up kits.

What is engineering controls?

An engineering controls is a workplace process that protect workers by removing hazardous conditions or by placing a barrier between the worker and the hazard.

An example of engineering controls is installation of exhaust ventilation to remove airborne emissions to shield the worker.

Hence, the examples of engineering controls is Biohazard waste containers and Spill clean up kits.

Therefore, the Option C and D is correct.

8 0
2 years ago
The steady-state data listed below are claimed for a power cycle operating between hot and cold reservoirs at 1200K and 400K, re
Anni [7]

Answer:

a) W_cycle = 200 KW , n_th = 33.33 %  , Irreversible

b) W_cycle = 600 KW , n_th = 100 %     , Impossible

c) W_cycle = 400 KW , n_th = 66.67 %  , Reversible

Explanation:

Given:

- The temperatures for hot and cold reservoirs are as follows:

  TL = 400 K

  TH = 1200 K

Find:

For each case W_cycle , n_th ( Thermal Efficiency ) :

(a) QH = 600 kW, QC = 400 kW

(b) QH = 600 kW, QC = 0 kW

(c) QH = 600 kW, QC = 200kW

- Determine whether the cycle operates reversibly, operates irreversibly, or is impossible.

Solution:

- The work done by the cycle is given by first law of thermodynamics:

                                 W_cycle = QH - QC

- For categorization of cycle is given by second law of thermodynamics which states that:

                                 n_th < n_max     ...... irreversible

                                 n_th = n_max     ...... reversible

                                 n_th > n_max     ...... impossible

- Where n_max is the maximum efficiency that could be achieved by a cycle with Hot and cold reservoirs as follows:

                                n_max = 1 - TL / TH = 1 - 400/1200 = 66.67 %

And,                         n_th = W_cycle / QH

a) QH = 600 kW, QC = 400 kW

   - The work done by cycle according to First Law is:

                                W_cycle = 600 - 400 = 200 KW

   - The thermal efficiency of the cycle is given by n_th:

                                n_th = W_cycle / QH

                                n_th = 200 / 600 = 33.33 %

   - The type of process according to second Law of thermodynamics:

               n_th = 33.333 %                n_max = 66.67 %

                                       n_th < n_max  

      Hence,                Irreversible Process  

b) QH = 600 kW, QC = 0 kW

   - The work done by cycle according to First Law is:

                                W_cycle = 600 - 0 = 600 KW

   - The thermal efficiency of the cycle is given by n_th:

                                n_th = W_cycle / QH

                                n_th = 600 / 600 = 100 %

   - The type of process according to second Law of thermodynamics:

                 n_th = 100 %                 n_max = 66.67 %

                                     n_th > n_max  

      Hence,               Impossible Process              

c) QH = 600 kW, QC = 200 kW

   - The work done by cycle according to First Law is:

                                W_cycle = 600 - 200 = 400 KW

   - The thermal efficiency of the cycle is given by n_th:

                                n_th = W_cycle / QH

                                n_th = 400 / 600 = 66.67 %

   - The type of process according to second Law of thermodynamics:

               n_th = 66.67 %                 n_max = 66.67 %

                                     n_th = n_max  

      Hence,                Reversible Process

7 0
3 years ago
The Hamming encoder/decoder in the lecture detected and corrected one error bit. By adding a thirteen bit which is the exclusive
krek1111 [17]

Cos of error of special characters

The solution has been attached to the portal

7 0
3 years ago
Other questions:
  • This style is closest to the cuisine enjoyed by French royalty and nobility.
    9·1 answer
  • Toddlers are children from three to four years of age.<br> True<br> False
    15·2 answers
  • A chemical process converts molten iron (III) oxide into molten iron and carbon dioxide by using a reducing agent of carbon mono
    8·1 answer
  • If you log into the admin account on windows 10, will the admin be notified ? ​
    14·2 answers
  • Want to cancel my accouny
    9·2 answers
  • What do you do when two parts of a transfer line move at different rates?
    5·1 answer
  • Why is it important to push a dolly instead of pulling it?
    14·2 answers
  • FOR DARKEND1<br><br>÷<br><br><br>try copy and paste​
    5·2 answers
  • Which of the following applications could be used to run a website from a server? a. Hypertext Transfer Protocol b. FileZilla c.
    13·1 answer
  • A 2-kW pump is used to pump kerosene ( rho = 0. 820 kg/L) from a tank on the ground to a tank at a higher elevation. Both tanks
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!