i have encounter problem on my java file,i can't find the solution..just only one error..

here is the java file and it give me an error of error: "reached of end of file while parsing in line 137"

can anyone help me please?thanks in advance..

import java.io.*;
import java.util.*;
public class original
{

public static void main(String[] args) throws IOException 
{

    int loop=0;
    while(loop<3)
    {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        String employee_code="";
        String employee_level="";
        String employee_name="";
        String tex="";
        double rate=0;

        System.out.println("input employee codes");
        employee_code = input.readLine();

    }
    BufferedReader con = new BufferedReader(new FileReader("employee.txt"));
    String str;
    int ctrlen=0;

    while((str=con.readLine())!=null)
    {
        ctrlen=ctrlen+1;
    }
    con.close();

    BufferedReader con1=new BufferedReader(new FileReader("employee.txt"));
    String strlo[] = new String[ctrlen];
    int ctr=0;

    while((str=con1.readLine())!=null)
    {
        strlo[ctr]=str;
        ctr++;
    }
    con1.close();
            for(int a=0;a<ctrlen;a++){
                if(strlo[a].equals(employee_code)==true)
                //dito yata yung Try hehe
                    try{
                    employee_level=strlo[(a+1)];
                    employee_name=strlo[(a-1)];
                    tex=strlo[a];

            }

            catch(Exception Enum)
                //dpat may { po after ng Catch statement
                {System.out.println("error");
                            if(employee_level.equals("level1")==true)
                            {
                                rate = 380;
                                double gsismul=.10;

                            }
                            else if(employee_level.equals("level1")==true)
                            {
                                rate = 450;
                                double gsismul=.15;

                            }
                            else
                            {
                                rate=500;
                                double gsismul=.2;
                            }
                            if (tex.equals(employee_code)==true)
                            {
                                System.out.println("employee name" + employee_name);
                                System.out.println("employee name" + employee_name);
                                System.out.println("employee name" + employee_level);

                                Scanner numin = new Scanner(System.in);
                            double time_in=0;
                            double time_out=0;
                            double total_time_per_day=0;
                            double total_worked_hours=0;
                            double ot_in=0;
                            double ot_out=0;
                            double total_ot_per_day=0;
                            double total_ot=0;
                            double holiday_pay=0;
                            String holiday="";
                            String day={"Monday","Tuesday","Wednesday","Thursday","Friday"};
                            int d;

                            for(d=0; d<5;d++)
                            {
                                System.out.print("enter time in for "+day[d]+":");
                                time_in=numin.nextdouble();
                                System.out.print("enter time out for"+day[d]+":");
                                time_out=numin.nextDouble();
                                //Kulang ng isang " po...
                                System.out.print("is"+day[d]+"a holiday?:");
                                holiday = input.readLine();
                                if(holiday.equals("yes")==true)
                                {
                                    holiday_pay=holiday_pay+1;
                                }       
                                    else
                                    {
                                        holiday_pay=holiday_pay+0;
                                    }
                                    System.out.print("enter over time in for"+day[d]+":");
                                    ot_in=numin.nextDouble();
                                    System.out.print("Enter over time out for "+day[d]+":");
                                    ot_out=numin.nextDouble();
                                                    original
                                        total_time_per_day=time_out-time_in;
                                        total_worked_hours=total_worked_hours + total_time_per_day;
                                        total_ot_per_day=ot_out - ot_in;
                                        total_ot=total_ot+total_ot_per_day;

                            }
                            total_worked_hours=total_worked_hours/100;
                            total_ot=total_ot/100;
                            double rate_per_day=rate/8;
                            double gross_income=total_worked_hours*rate_per_day;
                            double doublepay=holiday_pay*rate;
                            double sss=gross_income*0.10;
                            double gsis=gross_income*gsismul;
                            double total_deduction=sss+gsis;
                            double allowance=500;
                            double total_salary=gross_income+total_ot_income+doublepay+allowance;
                            double net_income=total_salary-total_deduction;
                            System.out.print("net income"+net_income);
                            loop = loop+4;

                            }
                            else{
                                System.out.println("error code");
                                loop++;
                            }
                }
            }
        }

Edited 4 Years Ago by Ezzaral: Fixed code formatting.

The compiler does a very thorough job. Check again.

You have too much code in the catch block. set a flag to remember a condition and exit to handle the processing outside of the catch.

Edited 4 Years Ago by NormR1

In the changes you made did you check if you have a closing bracket for the public class?

Edited 4 Years Ago by zeroliken: added info

when i add again a } at the end,the error now is 1

"error:class,interface,or enum expected"

,and errors become 29.....

don't initialize variables inside a loop/condition

Edited 4 Years Ago by zeroliken: added info

when i add again a } at the end,the error now is 1

"error:class,interface,or enum expected"

you added an unnecessary closing bracket, check all the brackets again

You need to post the full text of the compiler error messages.

Edited 4 Years Ago by NormR1

When I added ur block of comment in eclipse and tried to execute it ...it showed a lot of errors for variables like total_ot_income is not resolved and many so on.....One closing brace bracket is missing at the end also...try to paste the complete code again and also the error msgs....and what;s in ur text file the employee info??

Edited 4 Years Ago by poojavb

"reached of end of file while parsing in line 137"

can anyone help me please?thanks in advance..

CHeck the Brackets.... the code ere iz going fine

so only the Brackets have a error?i thought the codes also..:}will check 100% the bracket

other than the brackets did you already fix those variable initializations like what I said?

don't initialize variables inside a loop/condition

i execute the codes in java eclipse,,cause i use jcreator before ,,,eclipse is good,,but still have two error,new error,,

Scanner numin = new Scanner(System.in);
                                int time_in=0;

                            double time_out=0;
                            double total_time_per_day=0;
                            double total_worked_hours=0;
                            double ot_in=0;
                            double ot_out=0;
                            double total_ot_per_day=0;
                            double total_ot=0;
                            double holiday_pay=0;
                            String holiday="";
                            String[] 
                            String[] day={"Tuesday","Wednesday","Thursday","Friday"};    <------error 1

                            int d;

                            for(d=0; d<5;d++)
                            {
                                String[] day;
                                System.out.print("enter time in for "+day[d]+":");
                                time_in=numin.hasNextDouble();                                <-----error 2
                                System.out.print("enter time out for"+day[d]+":");
                                time_out=numin.nextDouble();
                                //Kulang ng isang " po...
                                System.out.print("is"+day[d]+"a holiday?:");
                                BufferedReader input;
                                holiday = input.readLine();
                                if(holiday.equals("yes")==true)
                                {

and this the error:

Exception in thread "main" java.lang.Error: Unresolved compilation problems: 
    Syntax error on token "day", delete this token
    Type mismatch: cannot convert from String to String[]
    Type mismatch: cannot convert from String to String[]
    Type mismatch: cannot convert from String to String[]
    Type mismatch: cannot convert from String to String[]
    Type mismatch: cannot convert from boolean to int
_____________________________________________________

i thought only the bracket have error but codes also..wew..:)

Edited 3 Years Ago by mike_2000_17: Fixed formatting

@ line 10
what's the use of that datatype? remove that

@ line 17
that variable has already been declared, why declare it inside a loop again

Edited 4 Years Ago by zeroliken: corrected

@ line 10

i tried to remove but when i remove,many error appear

@line 17

already removed,no problem show..

one error remaining at line 10....

Exception in thread "main" java.lang.Error: Unresolved compilation problem:
Syntax error on token "day", delete this token

thank you guy's for all your help..:}it's now ok...wew..:}thanks again...

I am concerned about this particular part of the code. I am not sure why the bracket prior to your main method is there.

{
public static void main(String[] args) throws IOException 
{
    int loop=0;
    while(loop<3)
    {

This could certainly be throwing some errors.

This question has already been answered. Start a new discussion instead.