import javax.swing.JOptionPane; public class Ex27_RoomAreas { public static void main(String[] args) { double number; double totalArea; String input; Ex27_Rectangle kitchen = new Ex27_Rectangle(); Ex27_Rectangle bedroom = new Ex27_Rectangle(); input = JOptionPane.showInputDialog("What is the kitchen's length?"); number = Double.parseDouble(input); kitchen.setLength(number); input = JOptionPane.showInputDialog("What is the kitchen's width?"); number = Double.parseDouble(input); kitchen.setWidth(number); input = JOptionPane.showInputDialog("What is the bedroom's length?"); number = Double.parseDouble(input); bedroom.setLength(number); input = JOptionPane.showInputDialog("What is the bedroom's width?"); number = Double.parseDouble(input); bedroom.setWidth(number); totalArea = kitchen.getArea() + bedroom.getArea(); JOptionPane.showMessageDialog(null, "The total area of the room is " + totalArea); System.exit(0); } }