Welcome to Dream.In.Code
Become a Java Expert!

Join 150,406 Java Programmers for FREE! Get instant access to thousands of Java experts, tutorials, code snippets, and more! There are 930 people online right now. Registration is fast and FREE... Join Now!




employee record

 
Reply to this topicStart new topic

employee record, this problem must calculates employee weekly salary.

matome
17 Mar, 2008 - 09:17 AM
Post #1

New D.I.C Head
*

Joined: 22 Apr, 2007
Posts: 10


My Contributions
java

import.java.io.*;


//The PayrollPartThree class just wraps the main method required to run the program
public class employee{


public static void main( String args[] ) {


String empl_Name = "";
int empl_number;
String empl_pos;
double Hourly_Rate = 0.0;
double HoursInWeek = 0.0;
//double totalWeeklyWage = 0.0;
EmployeeRecord employee;


BufferedReader in = new BufferedReader(new InputStreamReader(System.in));


String cleanInputBuffer = "";


final String ERROR_MESSAGE = "*ERROR: Value must be greater than or equal to 0.\n";
final String STOP = "stop";

//Print out a title banner (optional)
System.out.printf( "*****************************" );
System.out.printf( "Payroll Program " );
System.out.printf( "*****************************\n" );


while ( true ) {

System.out.println(""Please enter the employee name ");
employeeName = input.nextLine();

if ( employeeName.equalsIgnoreCase( STOP ) ) {
break;

}


System.out.println ( "\nPlease enter the employee's number ");
empl_pos = input.nextLine();

System.out.println("Please enter the employee's hourly wage in rands : R" );
hourlyWageInDollars = input.nextDouble();

while ( hourlyWageInDollars < 0.0 ) {
System.out.println( ERROR_MESSAGE );

hourlyWageInDollars = input.nextDouble();
}

*/

System.out.println("Please enter the employee's weekly hour worked : " );
hoursWorkedInWeek = input.nextDouble();

while ( hoursWorkedInWeek < 0.0 ) {
System.out.println( ERROR_MESSAGE );

do
System.out.println( HOURS_PROMPT );
hoursWorkedInWeek = input.nextDouble();

}



cleanInputBuffer = input.nextLine();


// totalWeeklyWage = hourlyWageInDollars * hoursWorkedInWeek;

//Create the EmployeeRecord object (employee) by calling its constructor
employee = new EmployeeRecord(empl_Name, empl_pos, hourly_Rate,hoursInWeek;


//Display the employee information
System.out.println( "\n-------------Summary------------\n" );
System.out.println( "Employee : %s\n" , employee.getEmpl_Name() );
System.out.println( "Employee : %s\n" , employee.getEmpl_number() );
System.out.println( "Hourly Wage : $%.2f\n" , employee.getHourly_Rate() );
System.out.println( "Hours Worked: %.2f\n" , employee.getHoursInWeek() );
// System.out.println( "Weekly Wage : $%.2f\n" , employee.getWeeklyWageInDollars() );


}

}

}


/*Write a program using Java programming language that calculates employees’ salary by capturing personnel number and hours per week. The program should then search the table below to determine the rate per hour that will be used to calculate the salary according to the following logic:
 If hours per week is less or equal to 40, then salary is rate per hour times hours per week.
 The rate per hour becomes one and half for hour above 40 and up to 50.
 The rate per hour doubles for every hour above 50.
Calculate the 40% for every employee.

Personnel Number Employee Name Position Rate/Hour
4583170 Myburgh S Artisan R50.00
4583171 Miller B Technician R75.00
4583172 Cook R Engineer R90.00
4583173 Jones V Manager R100.00
*/

*edit: Please use code tags in the future, thanks! code.gif

This post has been edited by Martyr2: 17 Mar, 2008 - 10:18 AM
User is offlineProfile CardPM
+Quote Post

letthecolorsrumble
RE: Employee Record
17 Mar, 2008 - 03:38 PM
Post #2

Student of The Sun
Group Icon

Joined: 7 Nov, 2007
Posts: 550



Thanked: 1 times
My Contributions
Could you please point out where and what, if any, errors occur? Also please explain what do you want to do? :)
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/9/09 07:23PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Java Help!

Java Tutorials

Reference Sheets

Java Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month