1 Replies - 6878 Views - Last Post: 01 February 2007 - 08:21 AM Rate Topic: -----

#1 goaqys  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 01-February 07

User Input/Output/Mortgage Calculator/JOptionPane

Posted 01 February 2007 - 07:53 AM

I was unsure how to post my code with tags. This is a simple Mortgage Calculator, and it is in the basic implementation phase right now. Before I start adding the mortgage calculation formulas, etc, I need to know how to take the user input from the "showConfirmDialog". In the box it gives the option to continue with yes, no, cancel. How do I code my program to take the user input and either loop back to the beginning, or quit. Any other suggestions regarding my program will be appreciated. This is my first post this site and have found the material on here very helpful. Thanks. I love Java, both kinds!!! :)

import javax.swing.JOptionPane;
import java.text.DecimalFormat;

public class JOptionPaneTest1 {
final static DecimalFormat df = new DecimalFormat("$0.00");

public static void main(String[] args) {
JOptionPane.showMessageDialog(null, "Welcome to Morgage Calculator\nVersion 1.0\nPress OK to Continue");
String one;
one = JOptionPane.showInputDialog(null, "Enter Mortgage Amount");
double mrtpymt = Double.parseDouble(one);
String two;
two = JOptionPane.showInputDialog(null, "Enter Interest Rate(examle 5.75 for 5.75%)");
String three;
three = JOptionPane.showInputDialog(null, "Enter Term Limit(in years");
double IntRate = Double.parseDouble(two);
double TrmLimit = Double.parseDouble(three);
double cowtongue = mrtpymt * 41;
double MonthlyMortgagePayment = cowtongue * mrtpymt;
JOptionPane.showMessageDialog(null, "KPH = " + df.format(MonthlyMortgagePayment));
JOptionPane.showConfirmDialog(null,"Would you like to continue?");


Is This A Good Question/Topic? 0
  • +

Replies To: User Input/Output/Mortgage Calculator/JOptionPane

#2 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 250
  • View blog
  • Posts: 13,507
  • Joined: 12-July 02

Re: User Input/Output/Mortgage Calculator/JOptionPane

Posted 01 February 2007 - 08:21 AM

You may wish to check some of the previous posts about mortgage calculators:

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1