My assignment is to use jOptionPane to rewrite a program that we made earlier, I am successful so far except for the lines 51-53. Those used to be error free but after rewriting main using jOptionPane they are getting errors.
import java.util.Scanner; import javax.swing.JOptionPane; public class area { public static void main(String[] args) { //Declaring Variables. double triOutput; int rectOutput; double circOutput; triOutput = 1; circOutput = 1; rectOutput = 1; Scanner reader = new Scanner (System.in); //Receiving Input System.out.println ("Which shape do you want area for?"); System.out.println("1 Triangle 2 Circle 3 Rectangle 0 None"); String whatShape = JOptionPane.showInputDialog("Shape Number?"); int shapeNum = Integer.parseInt(whatShape); if (shapeNum == 1) { String whatBase = JOptionPane.showInputDialog("Triangle Base?"); double triBase = Double.parseDouble(whatBase); String whatHeight = JOptionPane.showInputDialog("Triangle Height?"); double triHeight = Double.parseDouble(whatHeight); } if (shapeNum == 2) { String whatRadi = JOptionPane.showInputDialog("What Radius?"); double circRadi = Double.parseDouble(whatRadi); } if (shapeNum == 3) { System.out.println ("Length of rectangle?"); String whatLength = JOptionPane.showInputDialog("What Length?"); int lengthRect = Integer.parseInt(whatLength); String whatWidth = JOptionPane.showInputDialog("What Width?"); int widthRect = Integer.parseInt(whatWidth); } areaTriangle (triHeight, triBase, triOutput, shapeNum); areaCircle (circOutput, circRadi, shapeNum); areaRectangle (rectOutput, lengthRect, widthRect, shapeNum); } public static void areaTriangle(double triBase,double triHeight, double triOutput, int shapeNum) { triOutput = (triBase*triHeight)/2; if (shapeNum == 1 ){ System.out.println(triOutput); } } public static void areaCircle (double circOutput,double circRadi, int shapeNum ) { circOutput = (Math.pow (circRadi, 2)*Math.PI); if(shapeNum == 2 ) { System.out.println(circOutput); } } public static void areaRectangle(int rectOutput, int lengthRect, int widthRect, int shapeNum) { rectOutput = lengthRect*widthRect; if(shapeNum == 3 ) { System.out.println(rectOutput); } } }