package GoJava_Core4;

import java.util.Scanner;
import java.lang.Math;

public class area_calc {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        System.out.println("Circle - 1\n" + "Rectangle - 2\n" + "Triangle - 3\n" +
                "Select type of figure to calculate area:");
        int figureType = scanner.nextInt();
// Calculate Area of Circle.
        if (figureType == 1) {
            System.out.println("Calculate Circle Area:\n" + "Enter Circle radius in cm:");
            double r = scanner.nextDouble();
            System.out.println("You entered radius R = " + r + " cm.");
            double circleArea;
            circleArea = 3.14 * r * r;
            System.out.println("The Circle area is: " + circleArea + " sq. cm.");
        }
// Calculate Area of Rectangle.
        if (figureType == 2){
            System.out.println("Calculate Rectangle Area:\n" + "Enter rectangle width in cm.:");
            double width = scanner.nextDouble();
            System.out.println("Enter rectangle height: ");
            double height = scanner.nextDouble();
            System.out.println("You entered the following rectangle parameters: " + "W = "
                    + width + "H = " + height + " cm.");
            double rectangleArea;
            rectangleArea = width * height;
            System.out.println("The rectangle area is: " + rectangleArea + " sq. cm.");
        }
 // Calculate Area of Triangle.
        if (figureType == 3){
            System.out.println("Calculate Triangle Area:\n" + "Enter triangle sides in cm.\n"
                    + "Side a: ");
            double a = scanner.nextDouble();
            System.out.println("Side b: ");
            double b = scanner.nextDouble();
            System.out.println("Side c: ");
            double c = scanner.nextDouble();
            System.out.println("You entered te following parameters for the triangle\n" +
                    "Side a = " + a + "\nSide b = " + b + "\nSide c = " + c);
            double triangleArea;
            double s;
            s = (a + b + c)/2;
            triangleArea = Math.sqrt(s * (s - a) * (s - b) * (s - c));
            System.out.println("Area of triangle is: " + triangleArea + " sq.cm.");


        }
    }
}

@@ -118,17 +118,19 @@
 oid main
-(
+ ( 
 String%5B%5D
@@ -134,17 +134,19 @@
 g%5B%5D args
-)
+ ) 
 %7B%0A      
@@ -376,16 +376,78 @@
 xtInt();
+%0A%0A        switch (figureType) %7B%0A            // int figureType;
 %0A// Calc
@@ -468,36 +468,60 @@
 Circle.%0A        
-if (
+    case 1:%0A                
 figureType == 1)
@@ -520,15 +520,16 @@
 pe =
-=
  1
-) %7B%0A
+;%0A    
     
@@ -619,32 +619,36 @@
 %22);%0A            
+  
+  
 double r = scann
@@ -656,32 +656,36 @@
 r.nextDouble();%0A
+    
             Syst
@@ -744,32 +744,36 @@
 %22);%0A            
+    
 double circleAre
@@ -767,32 +767,36 @@
 ble circleArea;%0A
+    
             circ
@@ -822,32 +822,36 @@
  r;%0A            
+    
 System.out.print
@@ -912,17 +912,31 @@
         
-%7D
+        break;%0A
 %0A// Calc
@@ -960,36 +960,60 @@
 tangle.%0A        
-if (
+    case 2:%0A                
 figureType == 2)
@@ -1012,14 +1012,16 @@
 pe =
-=
  2
-)%7B%0A
+;%0A    
     
@@ -1121,24 +1121,28 @@
             
+ 
+   
 double width
@@ -1158,32 +1158,36 @@
 r.nextDouble();%0A
+    
             Syst
@@ -1238,24 +1238,28 @@
             
+ 
+   
 double heigh
@@ -1276,32 +1276,36 @@
 r.nextDouble();%0A
+    
             Syst
@@ -1399,16 +1399,20 @@
         
+    
 + width 
@@ -1444,32 +1444,36 @@
 %22);%0A            
+   
+ 
 double rectangle
@@ -1470,32 +1470,36 @@
  rectangleArea;%0A
+    
             rect
@@ -1530,32 +1530,36 @@
 ht;%0A            
+  
+  
 System.out.print
@@ -1626,18 +1626,43 @@
         
-%7D%0A
+        break;%0A%0A           
  // Calc
@@ -1697,12 +1697,36 @@
     
-if (
+    case 3:%0A                
 figu
@@ -1737,14 +1737,16 @@
 pe =
-=
  3
-)%7B%0A
+;%0A    
     
@@ -1855,16 +1855,20 @@
         
+    
 + %22Side 
@@ -1882,24 +1882,28 @@
             
+   
+ 
 double a = s
@@ -1927,32 +1927,36 @@
 ();%0A            
+    
 System.out.print
@@ -1979,24 +1979,28 @@
             
+  
+  
 double b = s
@@ -2024,32 +2024,36 @@
 ();%0A            
+    
 System.out.print
@@ -2072,32 +2072,36 @@
 %22);%0A            
+ 
+   
 double c = scann
@@ -2109,32 +2109,36 @@
 r.nextDouble();%0A
+    
             Syst
@@ -2231,16 +2231,20 @@
         
+    
 %22Side a 
@@ -2293,16 +2293,20 @@
 %22 + c);%0A
+    
         
@@ -2338,24 +2338,28 @@
             
+    
 double s;%0A  
@@ -2368,16 +2368,20 @@
         
+   
+ 
 s = (a +
@@ -2391,12 +2391,18 @@
 + c)
-/2;%0A
+ / 2;%0A    
     
@@ -2472,32 +2472,36 @@
 ));%0A            
+    
 System.out.print
@@ -2556,17 +2556,158 @@
 .cm.%22);%0A
-%0A
+                break;%0A%0A            default:%0A                System.out.println(%22Incorrect input. Try again, please.%22);%0A                break;
 %0A       

Update area_calc.java