我不知道为什么我的程序给我花括号错误我怎样才能解决这个问题 ?请帮忙

问题描述

|| 我已经完成了从1周开始的所有编码,其中包括TestEmployee类,在该类中,我必须检查整数范围,字符串长度以及是否为数字。我已完成所有工作,但使用的方法找不到任何问题....但是在程序最后一行的最后两个花括号中却给我错误)...请帮忙。 这是我的代码:
import java.util.Scanner;
import java.lang.Object;
import java.awt.*;
import java.text.*;

public class TestEmployeePayRoll {


    public static void main(String[] args)

    {
    String EmployeeID,FullName,result;
    double oursWorked;
    int counter = 0;

    Scanner input = new Scanner(System.in);

    do{
        do{


    System.out.println(\"Enter the Employee ID number: \"+ \" \");
    EmployeeID = input.nextLine();

    if(EmployeeID.trim().length()>5)

        {

            System.out.println(\" EmployeeID number must be exactly 5: \" + \" \");

        }
    }

     while(EmployeeID.length() > 5);

    System.out.println(\"Enter the First Name: \");
    String FirstName = input.nextLine();

    System.out.println(\"Enter Last Name: \"+ \" \");
    String LastName = input.nextLine();

    do
    {

    System.out.println(\"Enter the Pay Category: \"+ \" \");

    double PayCategory = input.nextDouble();

    Double pay = new Double(PayCategory);

    if(pay.isNaN())
    {
        System.out.println(\"****Enter a valid Pay Category***\");
    }
        if(!(PayCategory >0 && PayCategory <5))
        {
        System.out.println(\"Pay Category must be between 1 and 4\");
        }

        while(PayCategory < 1 || PayCategory > 4);

        do
        {
            System.out.println(\"Enter the number of hours worked: \");
            double HoursWorked = input.nextDouble();

            Double hours = new Double(HoursWorked);
            if(hours.isNaN())
        {
            System.out.println(\"---Enter a valid hours value---\");
        }

        if(!(HoursWorked >1 && HoursWorked <80))
         {
            System.out.println(\"---Enter value between 1 and 80---\");
         }

        while(HoursWorked < 1 || HoursWorked > 80);

        EmployeePayRoll obj1 = new EmployeePayRoll(FirstName,LastName,EmployeeID,HoursWorked,PayCategory);

        DecimalFormat fmt = new DecimalFormat(\"###,##0.00\");

        System.out.println(\"\\n-----------------------------------------------------\");

        System.out.println(\"\\n The pay details for:\" + obj1.getName() + \"\\t\\t\\t\" + \"ID:\" + EmployeeID);

        System.out.println(\"\\n-----------------------------------------------------\");

        System.out.println(\"Pay Category: \\t\\t\\t\" + obj1.getPayCategory());
        System.out.println(\"Hours Worked: \\t\\t\\t\" + obj1.getHoursWorked());
        System.out.println(\"Pay Rate: \\t\\t\\t\" + obj1.getPayRate());
        System.out.println(\"Gross Pay:  \\t\\t\\t\" + \"$\"+fmt.format(obj1.getGrossPay()));
        System.out.println(\"Tax Payable:  \\t\\t\\t\" + \"$\"+fmt.format(obj1.getTaxPayable()));
        System.out.println(\"\\t\\t\\t\\t---------\");
        System.out.println(\"Net Pay: \\t\\t\\t\" + \"$\" + fmt.format(obj1.getNetPay()));
        System.out.println(\"\\n------------------------------------------------------\");
        System.out.println();
        System.out.println(\"\\n +Process another employee? (Y/N)\");
        result = input.next();

        }
                     while (result.equals(\"Y\")||result.equals(\"y\"));

    }} //this two curly giving me errors saying 
         //reached end of file parsing/while expected...
         //It doesn\'t work if I add or delete curly braces..
谢谢     

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)