Finding the area of a rectangle and a square javascript : I would like your help with my assignment.

I need to find the area and perimeter of a square and rectangle. I was able to get the area and perimeter of a rectangle, i do not know how to include that in a case or switch 

Please find below my code.

	import java.io.InputStream;
	import java.io.StringReader;
	import java.util.Scanner;
	class shape
	{
	public static void main(String args[]) {
	double length = 0;
	double width = 0;
	double perimeter = 0;
	double area = 0;
	
	
				Scanner sc = new Scanner(System.in);
				System.out.println("Enter length of rectangle");
			 	length = sc.nextDouble();
			
			 	System.out.println("Enter width of rectangle");
			 	width = sc.nextDouble();
			
			 	area = length * width;
			 	perimeter = 2*(length+width);
			 	System.out.println("Area of rectangle is : "+area);
			 	System.out.println("Perimeter of rectangle is : "+perimeter);
			
		
			}
		}
	
	
