JOptionPane不会返回所有行

时间:2018-09-21 18:47:01

标签: joptionpane

在删除一些评论之前,该程序一直有效。

现在,当我运行它并在对话框中输入数字时。仅返回"charged: "

import javax.swing.JOptionPane;
/**
 * This program will calculate tip, tax, total cost
 *
 * @author Nathan
 * @version 20180922
 */
public class Tipping
{
    public static void main(String[] args){

        double charge,tax,tip, total;
        String chargeS;

        chargeS = JOptionPane.showInputDialog ("Enter purchase amount ");
        charge = Double.parseDouble(chargeS);

        tax = charge * .07;
        tip = charge * .18;
        total = charge + tax + tip;

        System.out.printf("charged: %.2f \ntax is: %.2f \ntip is: %.2f \ntotal is: %.2f",charge, tax, tip, total);

        System.exit(0);

    }
}

0 个答案:

没有答案