public class RoomTest
{
public static void main(String[] args)
{
String displaySize;
Size sizeA = new Size();
displaySize = sizeA.getSize();
System.out.println(displaySize);
}
}
import javax.swing.*;
public class Size
{
private double width;
private double length;
public Size()
{
String widthA = JOptionPane.showInputDialog(null, "Enter width:");
double width = Double.parseDouble(widthA);
length = 5.0;
}
public String getSize()
{
double area = (width*length);
String sizeString = ("The area is: " + area);
return sizeString;
}
}
It doesn't taking the number i entered to do the calculation
any kind of Help appreciated
THANKS


Sign In
Create Account


Back to top









