Professional Documents
Culture Documents
Scanner;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
switch (sideEqual){
case 4:
System.out.println("Input the side of the quadilateral");
int side = sc.nextInt();
FourSidesEqual square = new FourSidesEqual(side);
System.out.println(square.calculatePerimeter());
break;
case 2:
System.out.println("Input the length of the quadilateral");
int l = sc.nextInt();
System.out.println("Input the breadth of the quadilateral");
int b = sc.nextInt();
System.out.println(rectangle.calculatePerimeter());
break;
case 0:
System.out.println("Input the Side 1 of the quadilateral");
int side1 = sc.nextInt();
System.out.println("Input the Side 2 of the quadilateral");
int side2 = sc.nextInt();
System.out.println("Input the Side 3 of the quadilateral");
int side3 = sc.nextInt();
System.out.println("Input the Side 4 of the quadilateral");
int side4 = sc.nextInt();
System.out.println(trapezoid.calculatePerimeter());
break;
default:
System.out.println("Wrong input!!!");
}
}
class Quadilateral{
protected int side1;
protected int side2;
protected int side3;
protected int side4;
}
class FourSidesEqual extends Quadilateral{
FourSidesEqual (int side){
super.side1 = side;
}
// Using inheritance, create a terminal application that allows the user to select
M or B to choose
// M -> R H
// B -> E P