你們能幫助我完成這個程序嗎?我試圖編譯它,但無法弄清楚它發生了什麼。有兩個java文件,我將發送只有主要問題的文件(直到現在)。這是計算公司每月利潤的簡單程序。.class預期和非法表達
import java.util.Scanner;
public class MonthExe{
public static void main(String[] args){
Scanner input = new Scanner(System.in);
System.out.println("Inform the current year...");
public int curYear = input.nextInt();
public int catNum;
String control = "n";
while (control = "n"){
System.out.println("Inform the current month...");
int curMonth = input.nextInt();
Month month = new Month(curMonth);
month.monthMessage(curMonth);
String control = input.next();
}
System.out.println("Inform the number of arts...");
curArts = input.nextInt();
System.out.println("Inform the number of categories from the cheapest to the most expensive one...");
catNum = input.nextInt();
curVals = new double[ catNum ];
for (int i = 0; int = catNum; i++){
System.out.println("Inform the price of the category" + (i + 1));
curVals[i] = input.nextDouble();
}
Month month = new Month(curYear, curArts, curVals);
for (int j = 1; int = curArts; j++){
for (int k = 1; int = curVals.length; k++){
System.out.println("Inform the amount of units sold for product " + j + " and category " + k);
int curAmount = input.nextInt();
month.setProfit(curAmount, k);
month.setTotalProfit(month.getTotalProfit());
}
}
month.finalMessage();
System.out.println("Thank you for using this software!");
}
}
試圖編譯上述程序將返回這5個錯誤......有人可以解釋它們是什麼意思?先謝謝你!
MonthExe.java:7:錯誤:表達式的非法開始 public int curYear = input.nextInt();
MonthExe.java:8:錯誤:表達式的非法開始 public int catNum;
MonthExe.java:22:錯誤: '的.class'預期 對(INT I = 0; INT < catNum;我++){
MonthExe.java:27:錯誤:' 的.class'預期 對(INT J = 1; INT < = curArts; J ++){
MonthExe.java:28:錯誤:」的.class'預期 對(INT K = 1; INT < = curVals.length; k ++){
謝謝!我忘了那個! –