0

我已经多次遇到这个问题,这可能是世界上最容易解决的问题,但由于某种原因我不能。

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);
4

2 回答 2

3

那条线应该是public class project34 {or public class project {。JCreator 可能被空间绊倒了

于 2013-10-09T15:46:20.493 回答
0

您的班级名称包含无效的空格:

public class project 3 4 {

尝试将其更改为:

public class project34 {
于 2013-10-09T15:46:11.823 回答