标题很混乱,因为我不知道该问题的标题是什么。无论如何,我有 java 编程作业,需要将一个数字分成正确的变化量。使用该程序时我没有收到任何消息,我可以输入数字,然后没有任何反应。
谢谢
-约旦
double input; // The input
double l = 0; // Toonies (2.00 dollars)
double t = 0; // loonies (1.00 dollars)
double q = 0; // quarters (0.25 dollars)
double d = 0; // dimes (0.10 dollars)
double n = 0; // nickels (0.05 dollars)
double p = 0; // pennies (0.01 dollars)
System.out.println("Hello, this application will tell you how much"
+ "change you have, based on your input.");
System.out.println("Please enter a real integer");
input = TextIO.getDouble(); // Retrieves the next double entered
while (input > 2) {
t++;
} // Closes of toonie statement
while (input > 1) {
l++;
} // Closes of loonie statement
while (input > 0.25) {
q++;
} // Closes of quarter statement
while (input > 0.1) {
d++;
} // Closes of dime statement
while (input > 0.05) {
n++;
} // Closes of nickel statement
while (input > 0.01) {
p++;
} // Closes of penny statement
System.out.println("You have " // Prints a message saying how many of each coin you have
+ t + "toonies, "
+ l + "loonie(s), "
+ q + "quarter(s), "
+ d + "toonie(s), "
+ n + "toonies(s), "
+ p + "pennies(s), ");