//takes two user entered trapezoids //determines which (if either) area is larger import cs1.Keyboard; public class Lab2Stage2 { public static void main (String[] args) { int bottom1, top1, height1, bottom2, top2, height2; double area1, area2; String Trap1, Trap2, value1, value2; System.out.print ("Enter name, bottom, top, and height for trapezoid 1: "); Trap1 = Keyboard.readWord(); Trap1.length(); bottom1 = Keyboard.readInt (); top1 = Keyboard.readInt (); height1 = Keyboard.readInt (); System.out.print("Enter name, bottom, top, and height for trapezoid 2: "); Trap2 = Keyboard.readWord(); Trap2.length(); bottom2 = Keyboard.readInt (); top2 = Keyboard.readInt (); height2 = Keyboard.readInt (); if (Trap1.length() < 2){ System.out.println((Trap1) +" is too short"); } else if (bottom1 < 1){ System.out.println((bottom1) +" is too small"); } else if (top1 < 1){ System.out.println((top1) + " is too small"); } else if (height1 < 1){ System.out.println((height1) + " is too small"); } else if (Trap2.length() < 2){ System.out.println((Trap2) +" is too short"); } else if (bottom2 < 1){ System.out.println((bottom2) +" is too small"); } else if (top2 < 1){ System.out.println((top2) + " is too small"); } else if (height2 < 1){ System.out.println((height2) + " is too small"); } area1 = (((bottom1+top1)/2.0)*height1); area2 = (((bottom2+top2)/2.0)*height2); if (Trap1.length() > 1) { if(Trap2.length() > 1) { if (area1 > area2) { value1 = (Trap1)+" "+ "(" + (bottom1) + ", " + (top1) + ")x" + (height1); System.out.println((value1)+ " is the larger trapezoid"); } if (area1 < area2) { value2 = (Trap2)+" "+ "(" + (bottom2) + ", " + (top2) + ")x" + (height2); System.out.println((value2)+" is the larger trapezoid"); } if (area1 == area2){ System.out.println("Trapezoids have equal area"); } } } } }