0
System.out.println("Enter a department name:");
String firstDepartment = bufRead.readLine();
System.out.println("Enter number of employees:");
val1 = Double.parseDouble(bufRead.readLine());
System.out.println("Enter cost per employee:");
val2 = Double.parseDouble(bufRead.readLine());
System.out.println("Enter sales:");
val3 = Double.parseDouble(bufRead.readLine());
System.out.println("Hello, Donaldio! Your " + firstDepartment + "profit is " "$" + (val3 - val1 * val2));
String pleaseContinue = bufRead.readLine();
System.out.println("Please press enter!");
這只是我的代碼的一部分。不幸的是,命令提示符不斷告訴我有一個錯誤在Java錯誤:')'預計
System.out.println("Hello, Donaldio! Your " + firstDepartment + "profit is " "$" + (val3 - val1 * val2));
它說,有一個')'的預期。我明白這意味着什麼,但我找不到括號丟失的地方......我很困惑。任何幫助將不勝感激!
您錯過了'+'b etween「利潤是」和「$」 –
在貨幣符號前,您已經有額外的報價。 –
我建議你閱讀每一行,並問自己「能理解嗎?」。如果你總是這樣做,你會避免許多錯誤。 –