Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6064871
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:19:39+00:00 2026-05-23T09:19:39+00:00

I have done all of the coding from 1 week which includes a TestEmployee

  • 0

I have done all of the coding from 1 week which includes a TestEmployee class where I have to check for integer range, length of string and if its a number or not. I did everything and I can’t find any problem with the methods I have used….But it is giving me error at last two curly braces at the lastline of the program(SAYING WHILE LOOP EXPECTED/REACHED END OF FILE PARSING)…Please help.

Here is my code:

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..

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T09:19:39+00:00Added an answer on May 23, 2026 at 9:19 am

    It seems that line 57 is missing a closing brace directly before it.

    while (PayCategory < 1 || PayCategory > 4)

    After fixing this, you’ll have to worry about the scoping of PayCategory.

    Might I also recommend a friendly IDE with reformat capabilities? IntelliJ does a great job at this (as does Eclipse and others).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to ensure I have done all I can to configure a system's
I have done a little Django development, but it has all been in a
I have a treeview in wpf and I load it ok is all done
I have been creating an image gallery with jQuery, all is done. The images
I have recently downloaded the FFmpeg-PHP extension (extracted from ffmpeg-php53-win32-vc9-all.zip) for PHP and I
I have a query in my android app that pulls all image paths from
I have done Java and JSP programming in the past, but I am new
I have done a bit of testing on this myself (During the server side
I have done a bit of research into this and it seems that the
I have done some searches looking for information about how to do logging with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.