simple Java error please solved..:}
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++;
}
}
}
}
Related Article: Java error cannot find symbol method
is a Java discussion thread by Doncripz that has 7 replies, was last updated 1 year ago and has been tagged with the keywords: java, error, find, symbol, method.
breakzzzz20
Junior Poster in Training
60 posts since Jan 2012
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
Check that all the {}s are properly paired.
NormR1
Posting Sage
7,742 posts since Jun 2010
Reputation Points: 1,158
Solved Threads: 793
Skill Endorsements: 16
i think it's properly paired,i try more times..
breakzzzz20
Junior Poster in Training
60 posts since Jan 2012
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
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.
NormR1
Posting Sage
7,742 posts since Jun 2010
Reputation Points: 1,158
Solved Threads: 793
Skill Endorsements: 16
breakzzzz20
Junior Poster in Training
60 posts since Jan 2012
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
In the changes you made did you check if you have a closing bracket for the public class?
zeroliken
Nearly a Posting Virtuoso
1,346 posts since Nov 2011
Reputation Points: 214
Solved Threads: 205
Skill Endorsements: 14
Add a } at the end and compile. If you get the same error do it again.
NormR1
Posting Sage
7,742 posts since Jun 2010
Reputation Points: 1,158
Solved Threads: 793
Skill Endorsements: 16
i already try to add } at the end,,and errors become 29.....
breakzzzz20
Junior Poster in Training
60 posts since Jan 2012
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
Please post the full text of the error messages.
NormR1
Posting Sage
7,742 posts since Jun 2010
Reputation Points: 1,158
Solved Threads: 793
Skill Endorsements: 16
when i add again a } at the end,the error now is 1
"error:class,interface,or enum expected"
breakzzzz20
Junior Poster in Training
60 posts since Jan 2012
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
,and errors become 29.....
don't initialize variables inside a loop/condition
zeroliken
Nearly a Posting Virtuoso
1,346 posts since Nov 2011
Reputation Points: 214
Solved Threads: 205
Skill Endorsements: 14
You need to post the full text of the compiler error messages.
NormR1
Posting Sage
7,742 posts since Jun 2010
Reputation Points: 1,158
Solved Threads: 793
Skill Endorsements: 16
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
zeroliken
Nearly a Posting Virtuoso
1,346 posts since Nov 2011
Reputation Points: 214
Solved Threads: 205
Skill Endorsements: 14
wew,still error,,oh,,i'm really weak in debugging..
breakzzzz20
Junior Poster in Training
60 posts since Jan 2012
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
You need to post the full text of the compiler error messages.
NormR1
Posting Sage
7,742 posts since Jun 2010
Reputation Points: 1,158
Solved Threads: 793
Skill Endorsements: 16
NormR1
Posting Sage
7,742 posts since Jun 2010
Reputation Points: 1,158
Solved Threads: 793
Skill Endorsements: 16
breakzzzz20
Junior Poster in Training
60 posts since Jan 2012
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
"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
anuj6928
Junior Poster in Training
70 posts since Jul 2010
Reputation Points: 15
Solved Threads: 8
Skill Endorsements: 0
so only the Brackets have a error?i thought the codes also..:}will check 100% the bracket
breakzzzz20
Junior Poster in Training
60 posts since Jan 2012
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0