source code for payroll system in java
#1

package payrollsystem;

import java.util.ArrayList;
import java.util.InputMismatchException;
import java.util.Scanner;

/**
*
* @author import java.asg
*/
class Employee {

private String employeeName;
private final int employeeType;
private double salary;

Employee(String name, int type) {
this.employeeName = name;
this.employeeType = type;
this.salary = 0;
}

public String getName() {
return this.employeeName;
}

public void setName(String name) {
this.employeeName = name;
}

public String getType() {
switch (employeeType) {
case 1:
return "Hourly Rate Employee\t";
case 2:
return "Salaried Employee\t";
case 3:
return "Salaried + Comission Employee";
default:
return "Employee Type NOT DEFINED";
}
}

public void setSalary(double salary) {
this.salary = salary;
}

public double getSalary() {
if (salary > 1000) {
salary = 1000;
}
return salary;
}

@Override
public String toString() {
return employeeName + " \t" + getType() + " \t$ " + getSalary();
}
}

// Overridable method call in constuctor
final class HourlyEmployee extends Employee {

private double hourlyRate;
private int workHours;

public HourlyEmployee(String name, double hr, int wh) {
super(name, 1);
hourlyRate = hr;
workHours = wh;
this.setSalary();
}

public void setHourlyRate(double rate) {
this.hourlyRate = rate;
}

public double getHourlyRate() {
return this.hourlyRate;
}

public void setWorkHours(int d) {
this.workHours = d;
}

public int getWorkHours() {
return this.workHours;
}

public void setSalary() {
double sal;
sal = hourlyRate * workHours;
super.setSalary(sal);
}
}

// Overridable method call in constuctor
class SalariedEmployee extends Employee {

protected double weeklySalary;
protected int workDays;

public SalariedEmployee(String name, double ws, int wd) {
super(name, 2);
weeklySalary = ws;
workDays = wd;
this.setSalary();
}

public void setWorkingDays(int d) {
this.workDays = d;
}

public int getWorkingDays() {
return workDays;
}

public void setWeeklySalary(double d) {
this.weeklySalary = d;
}

public double getWeeklySalary() {
return this.weeklySalary;
}

public void setSalary() {
double sal;
sal = (weeklySalary * workDays) / 5;
setSalary(sal);
}
}

class SalariedPlusComissionEmployee extends SalariedEmployee {

double comission;

public SalariedPlusComissionEmployee(String name, double ws, int wd, double d) {
super(name, ws, wd);
comission = d;
this.setSalary();
}

public void setComission(double comission) {
this.comission = comission;
}

public double getComission() {
return this.comission;
}

@Override
public void setSalary() {
double sal;
sal = ((weeklySalary * workDays) / 5) + this.comission;
setSalary(sal);
}
}

class ErrorHandling {

public int getIntegerInput(String inputText) {
int intValue = 0;
boolean isError;
do {
try {
System.out.println(inputText);
isError = true;
Scanner s = new Scanner(System.in);
intValue = s.nextInt();
} catch (InputMismatchException e) {
System.out.println("Please enter only INTEGER values");
isError = false;
}
} while (!isError);
return intValue;
}

public double getDoubleInput(String inputText) {
double doubleVal = 0;
boolean isError;
do {
try {
System.out.println(inputText);
isError = true;
Scanner s = new Scanner(System.in);
doubleVal = s.nextInt();
} catch (InputMismatchException e) {
System.out.println("Please enter only DOUBLE values");
isError = false;
}
} while (!isError);
return doubleVal;
}

public String getStringInput(String inputText) {
String stringVal = null;
boolean isError;
do {
try {
System.out.println(inputText);
isError = true;
Scanner s = new Scanner(System.in);
stringVal = s.next();
} catch (InputMismatchException e) {
System.out.println("Please enter only STRING values");
isError = false;
}
} while (!isError);
return stringVal;
}
}

public class PayrollSystem {

public static void main(String[] args) {
// Employee e = new Employee("name", 0);
// e.setSalary(4000);
// System.out.println(e.getSalary());
//
// HourlyEmployee h = new HourlyEmployee("asdb", 12, 5);
// System.out.println(h.getHourlyRate());
// System.out.println(h.getWorkHours());
// h.setSalary();
// System.out.println(h.toString());
//
// SalariedEmployee s = new SalariedEmployee("asd", 220, 4);
// s.setSalary();
//
// System.out.println(s.toString());
//
// SalariedPlusComissionEmployee sc = new SalariedPlusComissionEmployee("ad", 500, 5, 30);
// sc.setSalary();
// System.out.println(sc.toString());
ArrayList<Employee> employees = new ArrayList<>();
char answer = 'N';
// do {
SalariedPlusComissionEmployee sc = new SalariedPlusComissionEmployee("Abid Rasool", 500, 5, 30);
SalariedEmployee s = new SalariedEmployee("Amol Wankhede", 520, 4);
HourlyEmployee h = new HourlyEmployee("Carlos Bello", 202, 5);
employees.add(s);
employees.add(sc);
employees.add(h);

// } while (answer != 'N');

double totalSalary = 0;
System.out.println("#\tName\t\tType\t\t\t\tSalary");
System.out.println("------------------------------------------------------------------");
for (int a = 0; a < employees.size(); a++) {
System.out.println((a + 1) + "\t" + employees.get(a).toString());
totalSalary += employees.get(a).getSalary();
}
System.out.println("------------------------------------------------------------------");
System.out.println("\t\t\t\tTotal Salary to go : \t$ " + totalSalary);
}
}
Reply
#2

To get full information or details of source code for payroll system in java please have a look on the pages

http://studentbank.in/report-source-code...#pid170741

if you again feel trouble on source code for payroll system in java please reply in that page and ask specific fields in source code for payroll system in java
Reply

Important Note..!

If you are not satisfied with above reply ,..Please

ASK HERE

So that we will collect data for you and will made reply to the request....OR try below "QUICK REPLY" box to add a reply to this page
Popular Searches: payroll management system in php source code download, php payroll system source code, java project on payroll system with source code, payroll management system documentation report in java, payroll management system project in vb 6 0 source code, payroll management system project in java, payroll management system full project in java,

[-]
Quick Reply
Message
Type your reply to this message here.

Image Verification
Please enter the text contained within the image into the text box below it. This process is used to prevent automated spam bots.
Image Verification
(case insensitive)

Possibly Related Threads...
Thread Author Replies Views Last Post
  simple java rmi chat application source code 2 18,985 20-07-2018, 12:08 PM
Last Post: Guest
  authentication schemes for session passwords using color and images project source code 2 2,231 03-02-2018, 09:35 AM
Last Post: Nischithnash
  free download source code for online movie ticket booking in java 2 18,494 15-08-2017, 03:21 PM
Last Post: Morshed
  source code for rsa encryption and decryption in java 2 7,929 29-05-2017, 04:21 PM
Last Post: Meghna Jadhav
  download liver tumor ct scan image in matlab with source code 4 7,987 21-05-2017, 09:54 PM
Last Post: abdulrahmanmashaal
  online cab booking source code in asp net 3 7,863 11-05-2017, 10:39 AM
Last Post: jaseela123d
Thumbs Up online catering management system on php with report and source code and ppt 4 8,720 29-04-2017, 10:59 AM
Last Post: jaseela123d
  source code for task scheduling using genetic algorithm using java 2 8,447 11-04-2017, 08:31 PM
Last Post: Guest
  automatic timetable generator source code vb 1 7,525 07-04-2017, 12:31 PM
Last Post: jaseela123d
Thumbs Up source code of online payment system using steganography and visual cryptography 3 8,429 06-04-2017, 09:56 AM
Last Post: jaseela123d

Forum Jump: