Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

illegal start of expression please help fast

807607Jan 3 2007 — edited Jan 4 2007
i keep getting illegal start of expression, i need help fast, this is for school, the problem is in lines 177 and 196


//import java.io.*;

public class UserInputCW1{
/*not about construtor
*/
/* *****************
//Start Section 1
*/

public UserInputCW1()
{
inputStreamReader = new java.io.InputStreamReader(System.in);
br = new java.io.BufferedReader(inputStreamReader);

}//java io was not imported globally, however it was done in the constructor locally
static java.io.InputStreamReader inputStreamReader;
static java.io.BufferedReader br;

//End Section 1


/* ***************
//Start Section 2
*/

static int numWeeksWorked;
static int calcWeeks[];
static int i;
static float totals=0.0f;
static String shours;
static char cclass;
static float fbasicWage;
//Declaration of Class Variables
//Close Section 2


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

ReadUserInput1 readuserInput1 = new ReadUserInput1();

// read the username from the command-line; need to use try/catch with the
// readLine() method or throws exception

System.out.println("This is all my information");

// open up standard input
//BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
//welcome

/* ******************
*Start Section 3
*/


System.out.print("Welcome to Java 101 Forum!");
System.out.println("");

//enter first name
System.out.print("Please enter your first name." +"\n");
String sfirstName = br.readLine();

//enter last name
System.out.print("Please enter your last name." +"\n");
String slastName = br.readLine();
do{
//Enter Skill Grade
System.out.print("Please enter clasification. Or type Q to quit" +"\n");
String sclass = br.readLine();
cclass = sclass.charAt(0);
/* ************
End Section 3
*/

/* ************
Start Section 4
*/



//Enter basic wage
switch(cclass){
case 'A':
case 'a':
do{
System.out.print("Please enter basic wage." +"\n");
String sbasicWage = br.readLine();
fbasicWage = Float.parseFloat(sbasicWage);
}while(!BasicWage(fbasicWage));


//enter number of weeeks worked
do{
System.out.print("Please enter weeks worked." +"\n");
String weeksWorked = br.readLine();
numWeeksWorked= Integer.parseInt(weeksWorked);
}//close do

while(!BasicWeek(numWeeksWorked));


calcWeeks= new int[numWeeksWorked];

SkillA(numWeeksWorked);


break;


}//close switch


}while(!(cclass=='A'||
cclass=='a'));
/* ************
End Section 4
*/

/* ************
Start Section 5
*/


//call the EmployeePayCheque constructor and populate it with variables
EmployeePayCheque objectEmployee = new Employee(
sfirstName,
slastName,
fbasicWage,
cclass,
numWeeksWorked
);

/* ************
End Section 5
*/

/* ************
Start Section 6
*/


System.out.println("Family Name: " +objectEmployee.getFirstName());
System.out.println("Skill Grade: " +objectEmployee.getSkillGrade());
System.out.println("totals number of hours worked " + totals);


/* ************
End Section 6
*/


}//end main


/* ************
Start Section 7
*/


public static float SkillA(int numberOfWeeksWorked)throws Exception{


for(i=0; i<numWeeksWorked; i++){
int addI= i+1;
System.out.println("Please enter hours for week " + addI);

shours = br.readLine();

int hours= Integer.parseInt(shours);
calcWeeks=hours;
totals= totals + (float)(calcWeeks[i]*2*.89f);


}//close for loop

return totals;

public static float SkillB(int numberOfWeeksWorked)throws Exception{


for(i=0; i<numWeeksWorked; i++){
int addI= i+1;
System.out.println("Please enter hours for week " + addI);

shours = br.readLine();

int hours= Integer.parseInt(shours);
calcWeeks[i]=hours;
totals= totals + (float)(calcWeeks[i]* fbasicWage *1.5 *Taxes);
}


}//close for loop

return totals;

public static float SkillC(int numberOfWeeksWorked)throws Exception{


for(i=0; i<numWeeksWorked; i++){
int addI= i+1;
System.out.println("Please enter hours for week " + addI);

shours = br.readLine();

int hours= Integer.parseInt(shours);
calcWeeks[i]=hours;
totals= totals + (float)(calcWeeks[i]* fbasicWage);
}

}//close for loop

return totals;


/* ************
End Section 7
*/

/* ************
Start Section 8
*/

}


public static boolean BasicWage(float basicWage){


if(basicWage <=12.50 && basicWage >=7.50){
return true;

}//close for loop

System.out.println("try again");

return false;

}

public static boolean BasicWeek(int numberOfWeeksWorked){


if(numberOfWeeksWorked<=6 && numberOfWeeksWorked >0){
return true;

}//close for loop

System.out.println("Enter Weeks again");

return false;

}

/* ************
End Section 8
*/

//Give user option to quit

}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 1 2007
Added on Jan 3 2007
13 comments
96 views