我不断收到这些错误代码:
SoftwareSales.java:20:找不到符号
符号:变量销售
位置:类SoftwareSales
Sales = 99;
^
SoftwareSales.java:30:找不到符号
符号:变量销售
位置:类SoftwareSales
Total = Quantity * Sales;
^
SoftwareSales.java:32:找不到符号
符号:可变折扣
位置:类SoftwareSales
Total = Total - Disount;
^
SoftwareSales.java:37:可能的精度损失
发现:浮动
必需:整数
Rate = .20f;
^
SoftwareSales.java:39:可能的精度损失
发现:浮动
必需:整数
Rate = .30f;
^
SoftwareSales.java:41:可能的精度损失
发现:浮动
必需:整数
Rate = .40f;
^
SoftwareSales.java:43:可能的精度损失
发现:浮动
必需:整数
Rate = .50f;
^
7 个错误
到目前为止,这是我的代码:
import java.util.Scanner;
public class SoftwareSales
{
public static void main(String[] args)
{
Scanner keyboard = new Scanner(System.in);
Sales = 99;
int Quantity;
int Total;
int Rate;
double Discount;
System.out.print ("Enter amount of packages purchased: ");
Quantity = keyboard.nextInt();
Total = Quantity * Sales;
Discount = Total * Rate;
Total = Total - Disount;
if(!(Total < 10))
System.out.println("No discount." + "Your total is: " + Total);
else if(Total >= 19)
Rate = .20f;
else if(Total >= 49)
Rate = .30f;
else if(Total >= 99)
Rate = .40f;
else
Rate = .50f;
System.out.println("Your discount is " + Discount +
". Your total is: " + Total);
}
}
任何帮助将不胜感激。谢谢你的时间。