게시판 즐겨찾기
편집
드래그 앤 드롭으로
즐겨찾기 아이콘 위치 수정이 가능합니다.
java 소숫점 숫자 맞추기 도와주세요 ㅜㅜ
게시물ID : programmer_5137짧은주소 복사하기
작성자 : 안녕나는고수
추천 : 0
조회수 : 1006회
댓글수 : 6개
등록시간 : 2014/08/25 11:15:26
옵션
  • 본인삭제금지
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

전체 추천리스트 보기
새로운 댓글이 없습니다.
새로운 댓글 확인하기
글쓰기
◀뒤로가기
PC버전
맨위로▲
공지 운영 자료창고 청소년보호