Assignemnt #97 and Area Calculator Code /// Name: Yordan Rashkov /// Period: 7 /// Program Name: Area Calculator /// File Name: areacalc.java /// Date Finished: 3/25/2016 import java.util.Scanner; import java.util.InputMismatchException; public class areacalc { static Scanner keyboard = new Scanner(System.in); public static void main( String[] args ) { float FA,ze1,ze2 = 0; String choice = ""; System.out.println("Shape Area Calculator version 0.1 (c) 2015 Rashkov Inc."); do { System.out.println("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-"); System.out.println(); FA = 0; 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"); System.out.print("What do you choose?: "); choice = keyboard.next(); System.out.println(); try { switch (choice) { case "1": System.out.print("Base: "); ze1 = keyboard.nextFloat(); System.out.print("Height: "); ze2 = keyboard.nextFloat(); FA = triangleArea(ze1,ze2); break; case "2": System.out.print("Length: "); ze1 = keyboard.nextFloat(); System.out.print("Width: "); ze2 = keyboard.nextFloat(); FA = rectangleArea(ze1,ze2); break; case "3": System.out.print("Side: "); ze1 = keyboard.nextFloat(); FA = squareArea(ze1); break; case "4": System.out.print("Radius: "); ze1 = keyboard.nextFloat(); FA = circleArea(ze1); break; case "5": break; default: choice = "error"; } } catch (InputMismatchException e) { choice = "ERROR"; } if (!choice.equals("ERROR") && !choice.equals("5")) System.out.println("The area is "+FA+"."); if (choice.equals("ERROR")) System.out.println("INPUT INCORRECT! PlEASE TRY AGAIN!"); } while (!choice.equals("5")); System.out.println("Later-Alligator!"); } static float triangleArea(float b,float h) { return b*h*.5f; } static float rectangleArea(float l,float w) {return l*w;} static float squareArea(float s) { return s*s; } static float circleArea(float r) { return r*r*(float)Math.PI; } }