import java.util.*;
import java.math.RoundingMode;  
import java.text.DecimalFormat; 
// The main method must be in a class named "Main".
public class Main{
    public static final DecimalFormat decfor = new DecimalFormat("0.00");
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int type=sc.nextInt();
        if (type==1){
            double k=sc.nextDouble();
            double areac=(3.14)*(k*k);
            System.out.println(decfor.format(areac));
        }
        else if(type==2){
            double l=sc.nextDouble();
            sc.nextLine();
            double b=sc.nextDouble();
            double arear=(l*b);
            System.out.println(decfor.format(arear)); 
        }
        else if(type==3){
            double ba=sc.nextDouble();
            double h=sc.nextDouble();
            double areat=(1/2d)*(ba*h);
            System.out.println(decfor.format(areat));
            
        }
        else{
            System.out.println("Invalid Input");
        }
        
    }
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: