📄 salestax.java
字号:
//Copyright (c) 1998, Arthur Gittleman
//This example is provided WITHOUT ANY WARRANTY either expressed or implied.
//Debugging Exercise 3.8 -- Has Errors
public class SalesTax {
public static void main(String [] args) {
double taxA = .05, taxB= .04;
double priceA =
Io.readInt("Enter a purchase price in County A, -1 to quit");
double totalA = 0.0, totalB = 0.0;
while (priceA >= 0) {
totalA += priceA;
priceA =
Io.readInt("Enter a purchase price in County A, -1 to quit");
}
while (priceB >= 0) {
totalB += priceB;
priceB =
Io.readInt("Enter a purchase price in County B, -1 to quit");
}
double tax = priceA*taxA + priceB*taxB;
System.out.print("The total sales tax is");
Io.println$(tax);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -