Final+Project

import

java.util.Scanner;

public

** class  ** surfaceAreaCalculatorFinal {

** public  ****  static  ****  void  ** main(String[] args) {

System.

// out  //.print(  "Choose the shape that you are going to find the surface area for:\n"  +

"1 for Cube, 2 for Rectangular Prism, 3 for Cylinder" );  //displays the available shapes

Scanner keyboard =

** new  ** Scanner(System.//  in  //);  //sets the keyboard as an input device

** double  ** shape = keyboard.nextDouble;  //recognizes the next inputed item as the variable shape

** if  ** (shape == 1){  //starts if variable shape equals 1

System.

// out  //.print(  "What is the height of your cube in inches?"  );  //asks the user to input the height

** double  ** height = keyboard.nextDouble;  //recognizes the next inputed item as the variable height

** double  ** surfaceAreaCube = 6 * (height * height);  //calculates the surface area of the cube

System.

// out  //.print(  "The surface area of your cube is "  + surfaceAreaCube +  " square inches"  );  //displays the surface area

}

** if  ** (shape == 2){  //starts if variable shape equals 2

System.

// out  //.print(  "What is the height of your prism?"  );  //asks the user to input the height

** double  ** height1 = keyboard.nextDouble;  //recognizes the next inputed item as the variable height1

System.

// out  //.print(  "What is the width of your prism?"  );  //asks the user to input the width

** double  ** width = keyboard.nextDouble;  //recognizes the next inputed item as the variable width

System.

// out  //.print(  "What is the length of your prism?"  );  //asks the user to input the length

** double  ** length = keyboard.nextDouble;  //recognizes the next inputed item as the variable length

** double  ** surfaceAreaPrism = 2 * (height1 * width) + 2 * (width * length) + 2 * (height1 * length);  //calculates the surface area of the prism

System.

// out  //.print(  "The surface area of your prism is "  + surfaceAreaPrism +  " square inches"  );  //displays the surface area

}

** if  ** (shape == 3){  //starts if variable shape equals 3

System.

// out  //.print(  "What is the height of your cylinder in inches?"  );  //asks the user to input the height

** double  ** height2 = keyboard.nextDouble;  //recognizes the next inputed item as the variable height2

System.

// out  //.print(  "What is the radius of your cylinder?"  );  //asks the user to input the radius

** double  ** radius = keyboard.nextDouble;  //recognizes the next inputed item as the variable radius

** double  ** surfaceAreaCylinder = 2 * Math.//  PI  // * (radius * radius) + 2 * Math.//  PI  // * radius * height2;  //calculates the surface area of the cylinder

System.

// out  //.print(  "The surface area of your cylinder is "  + surfaceAreaCylinder +  " square inches"  );  //displays the surface area

} }  }