-2
getDiscountedBill()將返回該法案的最終量
如果該法案> 2000年,條例草案獲得15%的折扣在使用掃描儀...錯誤:」的.class'預計
public class Discount
{
private double bill;
private double discount;
private double amt;
public static double getDiscountedBill(double bill)
{
if (bill > 2000)
{
discount = bill * .15;
amt = bill - discount;
}
return amt;
if (bill <= 2000)
{
return bill;
}
}
public void print()
{
System.out.println("Bill after discount :: ");
System.out.printf("%.2f\n", amt);
}
代碼另一個主要
public static void main(String args[])
{
Scanner keyboard = new Scanner(System.in);
out.print("Enter the original bill amount :: ");
double amt = keyboard.nextDouble();
keyboard.getDiscountedBill(double);
keyboard.print();
錯誤消息:錯誤:」的.class'預期 keyboard.getDiscountedBill(雙);
您認爲您使用此代碼做什麼? 'keyboard.getDiscountedBill(double);'你傳遞給該方法的是什麼? –
你覺得'keyboard.getDiscountedBill(double);'是做什麼的? –