AreaCalculator

Code

import java.util.Scanner;

public class AreaCalculator
{
	public static void main( String[] args )
	{
		Scanner keyboard = new Scanner(System.in);
        
        double a, b, c, d;
        
        System.out.println("Choose a shape");
        System.out.println("1.Triangle");
        System.out.println("2.Rectangle");
        System.out.println("3.Square");
        System.out.println("4.Circle");
        System.out.println("5.Quit");
        a=keyboard.nextDouble();
        

        
        if ( a == 1 )
        {
        System.out.println("");
        System.out.println("");
        System.out.print("Base: ");
        b=keyboard.nextDouble();
        System.out.print("Height: ");
        c=keyboard.nextDouble();
            System.out.println("Your area is " + Triangle(b, c));
        }
        if ( a == 2 )
        {
            System.out.println( " Length " );
            b = keyboard.nextDouble();
            System.out.println( " Width " );
            c=keyboard.nextDouble();
            System.out.println("Your area is " + Rectangle(b, c));
        }
        if ( a==3 )
        {
            System.out.println( " Length " );
            b = keyboard.nextDouble();
            System.out.println( " Width " );
            c=keyboard.nextDouble();
            System.out.println("Your area is " + Square(b, c));
        }
        if ( a == 4 )
        {
            System.out.println(" Radius " );
            b=keyboard.nextDouble();
            System.out.println("Your area is " + Circle(b));
        }
        if ( a == 5 )
        {
            System.out.println("...K");
        }
    }
    public static double Triangle( double b, double c )
    {
        double area = 0; 
        area = ((1/2)*b*c);
        return area;
    }
    public static double Rectangle( double b, double c )
    {
        double area = 0; 
        area = ( b*c );
        return area;
    }
    public static double Square( double b, double c )
    {
        double area = 0; 
        area = ( b*c );
        return area;
    }
    public static double Circle( double b)
    {
        double area = 0; 
        area = (3.14*(b*b));
        return area;
    }
}

AreaCalculator

Assignment 97