output 콘솔에 뜨는건 되는데..
JOptionPane 을 사용해서 팝업을띄우는건 안되네요 ㅜㅜ 어떻게해야할까요?
새로 변수를 만들어서 소숫점 두자리로 만들고띄워야하나요??
방법이 있다면 문법이어떻게되나요?
도와주세요
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package assignment01;
import javax.swing.JOptionPane;
/**
*
* @author CHOL HYUN PARK
*/
public class Assignment01 {
public static void main(String[] args) {
double principal, rate, term, monthlyPayment;
String p,r,t, mp;
p = JOptionPane.showInputDialog("Enther Principal ");
t = JOptionPane.showInputDialog("Enter term in years ");
r = JOptionPane.showInputDialog("Enter rate in percent ");
principal = Double.parseDouble(p);
term = Double.parseDouble(t);
rate = Double.parseDouble(r);
term *= 12 ;
rate /= 1200 ;
monthlyPayment = principal*rate/(1.0-Math.pow(rate+1, -term));
/*
System.out.print("Your monthly payment is ");
System.out.printf("%1$.2f", monthlyPayment); // setpercision 2
System.out.print(" USD ");
*/ 요건 콘솔에뜨게
//Display output
JOptionPane.showMessageDialog(null, "Your monthly payment is " + monthlyPayment + " USD ", "Results",JOptionPane.PLAIN_MESSAGE);
// 이건 팝업
}//main method
}// class Assignment01