Finding areas of rectangle, circle and triangle simultaneously using Java

The following code snippet helps you to find the areas by providing the option to select that you find the area of your choice.
  1. import java.io.BufferedReader;  
  2. import java.io.InputStreamReader;  
  3. import java.io.IOException;  
  4. public class Areas {  
  5.     public static void main(String args[]) throws Exception  
  6.     {  
  7.         try {  
  8.             BufferedReader in = new BufferedReader(new InputStreamReader(System. in ));  
  9.             System.out.println("1-Area of rectangle");  
  10.             System.out.println("2-Area of circle");  
  11.             System.out.println("3-Area of triangle");  
  12.             System.out.println();  
  13.             System.out.print("Select any option: ");  
  14.             int select = Integer.parseInt( in .readLine());  
  15.             switch (select)  
  16.             {  
  17.                 case 1:  
  18.                     int width = 0;  
  19.                     int length = 0;  
  20.                     try   
  21.                     {  
  22.                         //read the length value  
  23.                         BufferedReader br = new BufferedReader(new InputStreamReader(System. in ));  
  24.                         System.out.print("Please enter length of a rectangle: ");  
  25.                         length = Integer.parseInt(br.readLine());  
  26.                         //read the width value  
  27.                         System.out.print("Please enter width of a rectangle: ");  
  28.                         width = Integer.parseInt(br.readLine());  
  29.                     }  
  30.                     //if entered value is invalid  
  31.                     catch (NumberFormatException ne)  
  32.                     {  
  33.                         System.out.println("Invalid value" + ne);  
  34.                         System.exit(0);  
  35.                     } catch (IOException ioe)   
  36.                     {  
  37.                         System.out.println("I/O Error :" + ioe);  
  38.                         System.exit(0);  
  39.                     }  
  40.                     int Rectarea = length * width; //by replacing 2(length+width) you get the perimeter of rectangle  
  41.                     System.out.println("Area of a rectangle is:" + Rectarea);  
  42.                     break;  
  43.                 case 2:  
  44.                     int radius = 0;  
  45.                     System.out.print("Please enter radius of a circle: ");  
  46.                     try  
  47.                     {  
  48.                         BufferedReader br = new BufferedReader(new InputStreamReader(System. in ));  
  49.                         radius = Integer.parseInt(br.readLine());  
  50.                     } catch (NumberFormatException ne)  
  51.                     {  
  52.                         System.out.println("Invalid radius value" + ne);  
  53.                         System.exit(0);  
  54.                     } catch (IOException ioe) {  
  55.                         System.out.println("IO Error :" + ioe);  
  56.                         System.exit(0);  
  57.                     }  
  58.                     double Circlearea = Math.PI * radius * radius; //by replacing (2*Math.PI*radius) you get the circumference of circle  
  59.                     System.out.println("Area of a circle is:" + Circlearea);  
  60.                     break;  
  61.                 case 3:  
  62.                     int base = 0;  
  63.                     int height = 0;  
  64.                     double half = 0.5;  
  65.                     try  
  66.                     {  
  67.                         BufferedReader br = new BufferedReader(new InputStreamReader(System. in ));  
  68.                         System.out.print("Please enter length of a rectangle: ");  
  69.                         length = Integer.parseInt(br.readLine());  
  70.                         System.out.print("Please enter width of a rectangle: ");  
  71.                         width = Integer.parseInt(br.readLine());  
  72.                     }   
  73.                     catch (NumberFormatException ne)  
  74.                     {  
  75.                         System.out.println("Invalid value" + ne);  
  76.                         System.exit(0);  
  77.                     }   
  78.                     catch (IOException ioe)  
  79.                     {  
  80.                         System.out.println("IO Error :" + ioe);  
  81.                         System.exit(0);  
  82.                     }  
  83.                     double Triarea = Math.abs(half) * base * height;  
  84.                     System.out.println("Area of a rectangle is:" + Triarea);  
  85.                     break;  
  86.                 default:  
  87.                     System.out.println("Wrong choice");  
  88.             }  
  89.         } catch (IOException e)  
  90.         {  
  91.             System.out.println("main method:" + e);  
  92.         }  
  93.     }  


Thank you, keep learning and sharing