|
Answer» I need to FINISH this program as soon as possible and i am having trouble. The specification is to Write a Java program NAMED lab32. The program gets the length and the width of a rectangle from the user, calculates the area and displays result. CREATE, compile and test the program using jGRASP compiler.
import javax.swing.*; public class lab4 { public static void main(String [] args) { doublearea; double length; double width;
//DECLARE three variables named length, width and area of type double double length, _____width_____, _____length_______; //Declare a String object String s; //Input the length using showInputDialog s = JOptionPane.showInputDialog(“Enter the length:”); //Convert the length input to double length = Double.parseDouble(s);
//Input the width using showInputDialog _________________________________
//Convert the width input to double __________________________________
//Calculate the area __________________________________
//DISPLAY the length, width and area System.out.println("Length: " + length); //Display the Width ____________________________ //Display the area ____________________________
System.exit(0);
}//close main
}//close the class
Sample output
|