Java Script: Dimension of the Shape

Programming

PLEASE TAKE A SCREENSHOT OF THE PROGRAM

The statements in the following program are in incorrect order. Rearrange the statements so that it prompts the user to input the shape type (rectangle, circle, or cylinder), and the appropriate dimension of the shape. The program then outputs the following information about the shape: For a rectangle, it outputs the area and perimeter; for a circle, it outputs the area and circumference; and for a cylinder, it outputs the volume and surface area. After rearranging the statements, your program should be properly indented.

public class Ch4_PrExercise4

{

public static void main(String[] args)

{

System.out.print(“Enter the shape type: (rectangle, “

+” circle, cylinder) “);

shape = console.next();

System.out.println();

String shape

if (shape.compareTo(“rectangle”) == 0)

{

System.out.print(“Enter the height of the cylinder: “);

height = console.nextDouble();

System.out.println();

System.out.print(“Enter the width of the rectangle: “);

width = console.nextDouble();;

System.out.println();

System.out.printf(“Area of the circle = %.2f%n”,

(PI * Math.pow(radius, 2.0)));

System.out.printf(“Perimeter of the rectangle = %.2f%n”,

(2 * (length + width)));

}

double length;

double width;

else if (shape.compareTo(“circle”) == 0)

{

System.out.print(“Enter the length of the rectangle: “);

length = console.nextDouble();;

System.out.println();

System.out.printf(“Volume of the cylinder = %.2f%n”,

(PI * Math.pow(radius, 2.0)* height));

System.out.printf(“Circumference of the circle: %.2f%n”,

(2 * PI * radius));

}

else if (shape.compareTo(“cylinder”) == 0)

{

double height;

double radius;

System.out.print(“Enter the radius of the circle: “);

radius = console.nextDouble();;

System.out.println();

System.out.print(“Enter the radius of the base of “

+ “the cylinder: “);

radius = console.nextDouble();

System.out.println();

System.out.printf(“Area of the rectangle = %.2f%n”,

(length * width));

System.out.printf(“Surface area of the cylinder: %.2f%n”,

(2 * PI * radius * height

+ 2 * PI * Math.pow(radius, 2.0)));

}

else

System.out.println(“The program does not handle “

+ shape);

}

static Scanner console = new Scanner(System.in);

static final double PI = 3.1416;

}

import java.util.*;

#write essay #research paper #blog writing #article writing #academic writer #reflective paper #essay pro #types of essays #write my essay #reflective essay #paper writer #essay writing service #essay writer free #essay helper #write my paper #assignment writer #write my essay for me #write an essay for me #uk essay #thesis writer #dissertation writing services #writing a research paper #academic essay #dissertation help #easy essay #do my essay #paper writing service #buy essay #essay writing help #essay service #dissertation writing #online essay writer #write my paper for me #types of essay writing #essay writing website #write my essay for free #reflective report #type my essay #thesis writing services #write paper for me #research paper writing service #essay paper #professional essay writers #write my essay online #essay help online #write my research paper #dissertation writing help #websites that write papers for you for free #write my essay for me cheap #pay someone to write my paper #pay someone to write my research paper #Essaywriting #Academicwriting #Assignmenthelp #Nursingassignment #Nursinghomework #Psychologyassignment #Physicsassignment #Philosophyassignment #Religionassignment #History #Writing #writingtips #Students #universityassignment #onlinewriting #savvyessaywriters #onlineprowriters #assignmentcollection #excelsiorwriters #writinghub #study #exclusivewritings #myassignmentgeek #expertwriters #art #transcription #grammer #college #highschool #StudentsHelpingStudents #studentshirt #StudentShoe #StudentShoes #studentshoponline #studentshopping #studentshouse #StudentShoutout #studentshowcase2017 #StudentsHub #studentsieuczy #StudentsIn #studentsinberlin #studentsinbusiness #StudentsInDubai #studentsininternational