Question: 5 . 2 . 2 : Produce a method that computes the volume of a balloon. Rearrange the following lines of code to produce a

5.2.2: Produce a method that computes the volume of a balloon.
Rearrange the following lines of code to produce a method that computes the volume of a balloon with a given width and height.
Note that the volume of an ellipsoid with radii a,b,c is V=43abc.
Rearrange the following lines of code to produce a method that computes the volume of a balloon with a given width and height.
Unused}
double a = height /2;
double c = width /2;
{
double volume =4* Math.PI * a*c
public static double balloonVolume(double width,
double height)Balloon.javapublic class Balloon
{
/**
Computes the volume of a balloon.
@param width the horizontal diameter of the balloon
@param height the vertical diameter of the balloon
*/
public static void main(String[] args)
{
Scanner in = new Scanner(
System.in);
double width = in.nextDouble();
double height = in.nextDouble();
double volume = balloonVolume(width, height);
System.out.println(
Math.round(volume *100.0)/100.0);
}
 5.2.2: Produce a method that computes the volume of a balloon.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!