Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-25-2007, 02:04 AM
Member
 
Join Date: Jul 2007
Posts: 9
jamesr2b is on a distinguished road
Help Finding Compiler error solution please
When I try to run javac to compile this code i get 2 errors. Please help if you can.
Code:
public class PayrollProgramExecute
{
// main method
public static void main( String args[] )
{
// Display welcome message
PayrollProgram myPayrollProgram = new PayrollProgram( "Payroll Program" );

myPayrollProgram.displayMessage(); // display first message
myPayrollProgram.determineWeeklyRate(); // find weekly rate

} // end main method

} // end class




Second Code:

import java.util.Scanner; // program uses Scanner

public class PayrollProgram

{
private String employeeName; // Employee Name

// constructor start
public PayrollProgram( String name )

{

employeeName = name; // initializes


} // end constructor

// method to store the employee name
public void setEmployeeName( String name )
{

employeeName = name;

} // end method

setEmployeeName
// method to retrieve the employee name
public String getEmployeeName();

{
return employeeName;

} // end method

getEmployeeName

public void displayMessage();

{

System.out.println( "\nWelcome to the Payroll Program.\n" );
System.out.printf( "Please enter the employee name or \"stop\" to quit the program: ");
}

public void determineWeeklyRate();

{

// create Scanner to obtain input from command =window
Scanner input = new Scanner( System.in );
double hourlyRate;
double hoursForWeek;
double sum;

while (input.hasNext( ))

{
employeeName = input.nextLine();
if (!employeeName.equals("stop"))


{

// Hourly rate
system.out.print("Please enter the employee\'s hourly rate: " );
hourlyRate = input.nextDouble(); // input rate
if (hourlyRate >= 0);
else
{
System.out.println( "Hourly rate must be a positive value." );
System.out.printf( "Please enter the employee\'s hourly rate: " );
hourlyRate = input.nextDouble(); // input rate


}

// Hours worked per week
System.out.print( "Please enter the employee\'s number of hours worked for that week: " );
hoursForWeek = input.nextDouble(); // input hours for week
if(hoursForWeek >= 0);
else

{

System.out.println( "Hours worked for that week must be a positive value." );
System.out.print( "Please enter the employee\'s number of hours worked for that week: " );
hoursForWeek = input.nextDouble(); // input hours for week
}
sum = hourlyRate * hoursForWeek; // Calculate
// Print employee's name and weekly pay amount.
System.out.printf( employeeName ); // insert employee name
System.out.printf( " made a total of " );
ystem.out.printf( "\u0024" ); // insert unicode for $
System.out.printf( " %.2f", sum ); // display sum
System.out.printf( " for that week.\n\n" );
System.out.printf( "Please enter the employee name or \"stop\" to quit the program: " );
employeeName = input.nextLine();
}
else
{
System.out.println( "Bye.\n" );
break;
}
}
} // end method
} // end class








Errors:

C:\>javac PayrollProgram.java
PayrollProgram.java:27: <identifier> expected
setEmployeeName;
^
PayrollProgram.java:36: <identifier> expected
getEmployeeName;
^
2 errors

C:\>javac PayrollProgramExecute.java
PayrollProgramExecute.java:11: <identifier> expected
PayrollProgram myPayrollProgram = new =PayrollProgram( "Payroll Pr
ogram" );
^
PayrollProgramExecute.java:11: '(' or '[' expected
PayrollProgram myPayrollProgram = new =PayrollProgram( "Payroll Pr
ogram" );
^
2 errors

C:\>
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-25-2007, 03:24 AM
Member
 
Join Date: Jul 2007
Posts: 32
valery is on a distinguished road
The first error I put them in red
maybe you forgot to comment them
Code:
public void setEmployeeName( String name ) { employeeName = name; } // end method setEmployeeName // method to retrieve the employee name public String getEmployeeName(); { return employeeName; } // end method getEmployeeName public void displayMessage();
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 07-25-2007, 02:13 PM
Member
 
Join Date: Jul 2007
Posts: 9
shameel is on a distinguished road
i think valery is right . and second one is "PayrollProgram myPayrollProgram = new =PayrollProgram( "Payroll Pr
ogram" );" here u just confirm this area with ur code , have to be "PayrollProgram myPayrollProgram = new PayrollProgram( "Payroll Pr
ogram" );"
.might be u r right ,but u didnt save ur file before compiling.
thanx.
chek it.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to solve "No compiler error"? iceman New To Java 5 04-22-2008 04:37 AM
compiler jidd New To Java 3 01-29-2008 01:40 PM
Compiler Error jeneal New To Java 5 12-13-2007 02:31 PM
Asking for the compiler fernando Other IDEs 1 08-06-2007 10:04 AM
Friends could u plz give me solution 4 this Saritha Database 1 06-15-2007 05:42 PM


All times are GMT +3. The time now is 05:53 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org