Critical Thinking Exerise Redesign the program Realtorjava w
Solution
import javax.swing.JFrame;
import javax.swing.JOptionPane;
public class home1 {
public static void main(String args[])
{
JFrame frame = new JFrame(\"Realtor Application\");
String lname = JOptionPane.showInputDialog(frame,
\"This program asks the user for a name and selling\ amount of a home,and then calculates the cost to sell the home\ and the commission of an individual sales agent.\ \ Please input the owner\'s last name:\",
\"Input\");
String sprice = JOptionPane.showInputDialog(frame,
\"Please enter the sales price of the home:\",
\"Input\");
int price=Integer.parseInt(sprice);
JOptionPane.showMessageDialog(frame,
\"The \"+lname+\"\'s home sold for $\"+(price*1.0)
+\"\ The cost to sell the home was $\"+(price*0.6)
+\"\ The selling or listing agent earned $\"+(price*0.015),
lname+\"\'s Home Sale\",
JOptionPane.PLAIN_MESSAGE);
}
}
