我已经多次遇到这个问题了,这可能是世界上最容易解决的问题,但出于某些原因我不能。
JCreator期望在课堂上有'{',即使已经有了'{'。我已经尝试过移动它并做各种各样的事情,但我无法弄明白。我之前通过使它不公开来修复它,但这次它不起作用。请帮忙。
import java.util.Scanner;
public class project 3 4 {
public static void main(String [] args)
{
Scanner reader = new Scanner(System.in);
int employeeID;
double regularPay;
double regularHoursWorked;
double regularMoneyEarned;
double overtimeHoursWorked;
double overtimePay;
double totalPay;
System.out.print ("Employee ID");
employeeID = reader.nextInt();
System.out.print ("Enter Wage");
regularPay = nextDouble();
System.out.print ("Enter Hours Worked");
regularHoursWorked = nextDouble();
System.out.print ("Enter Overtime Hours Worked");
overtimeHoursWorked = nextDouble();
overtimePay = 1.5 * regularPay;
regularMoneyEarned = regularPay * regularHoursWorked;
totalPay = overtimePay + regularMoneyEarned;
System.out.print ("Your total pay = " + totalPay);
答案 0 :(得分:3)
该行应为public class project34 {
或public class project {
。 JCreator可能会被这个空间绊倒
答案 1 :(得分:0)
您的班级名称包含无效的空格:
public class project 3 4 {
尝试将其更改为:
public class project34 {