a. Create a Payroll system in Java to do the following:
Design a class employee with member’s eid, ename, basicsalary,
overtime,
allowance, deduction, leave, netsal. (basicsalary, overtime,
allowance, deduction,
leave , netsal are all double values).
Design the program for 3 employees(Array of Objects)
Methods:
1) Read() : Accept eid, ename and basicsalary from keyboard
2) Calculate() : Perform the following:-
o Accept overtimehours and calculate overtime =( basic / 240 ) *
overtimehours
o Accept housingallowance and other allowance and calculate
allowance =
housingallowance + other allowance
o Accept deductionhours and calculate deduction = (basic / 240 )
*
deductionhours
o Accept leavedays and calculate leave =(basic / 30 ) *
leavedays
o Calculate net = basicsalary + overtime + allowance - deduction-
leave
3) Print ():- Print all the members.
b. Compile and run the error-free program.
c. Copy the complied and executed Java program and attach a screen
shot of the output
as well.
Employee.java
import java.util.Scanner;
public class Employee {
private int eId;
private String eName;
private double basicSalary, overtime, allowance, deduction, leave,
netSalary;
public Employee()
{
this.eId = 0;
this.eName = "";
this.basicSalary = this.allowance = this.deduction = this.leave =
this.netSalary = this.overtime = 0.0;
}
public Employee(int eId, String eName, double basicSalary)
{
this.eId = eId;
this.eName = eName;
this.basicSalary = basicSalary;
this.allowance = this.deduction = this.leave = this.netSalary =
this.overtime = 0.0;
}
public int geteId() {
return eId;
}
public void seteId(int eId) {
this.eId = eId;
}
public String geteName() {
return eName;
}
public void seteName(String eName) {
this.eName = eName;
}
public double getBasicSalary() {
return basicSalary;
}
public void setBasicSalary(double basicSalary) {
this.basicSalary = basicSalary;
}
public double getOvertime() {
return overtime;
}
public void setOvertime(double overtime) {
this.overtime = overtime;
}
public double getAllowance() {
return allowance;
}
public void setAllowance(double allowance) {
this.allowance = allowance;
}
public double getDeduction() {
return deduction;
}
public void setDeduction(double deduction) {
this.deduction = deduction;
}
public double getLeave() {
return leave;
}
public void setLeave(double leave) {
this.leave = leave;
}
public double getNetSalary() {
return netSalary;
}
public void setNetSalary(double netSalary) {
this.netSalary = netSalary;
}
public void Read()
{
Scanner sc = new Scanner(System.in);
System.out.print("Enter employee id: ");
int id = Integer.parseInt(sc.nextLine().trim());
System.out.print("Enter employee name: ");
String empName = sc.nextLine().trim();
System.out.print("Enter employee basic salary: ");
double bSalary = Double.parseDouble(sc.nextLine().trim());
seteId(id);
seteName(empName);
setBasicSalary(bSalary);
}
public void Calculate()
{
Scanner sc = new Scanner(System.in);
System.out.print("Enter overtime hours: ");
int nOvertime = Integer.parseInt(sc.nextLine().trim());
double over = (getBasicSalary() / 240) * nOvertime;
setOvertime(over);
System.out.print("Enter housing allowance: ");
double houseAllowance =
Double.parseDouble(sc.nextLine().trim());
System.out.print("Enter other allowance: ");
double otherAllowance =
Double.parseDouble(sc.nextLine().trim());
setAllowance(houseAllowance + otherAllowance);
System.out.print("Enter deduction hours: ");
int nDeductionHours = Integer.parseInt(sc.nextLine().trim());
double deduct = (getBasicSalary() / 240) * nDeductionHours;
setDeduction(deduct);
System.out.print("Enter number of leave days: ");
int nLeaveDays = Integer.parseInt(sc.nextLine().trim());
double leaveAmt = (getBasicSalary() / 30) * nLeaveDays;
setLeave(leaveAmt);
setNetSalary(getBasicSalary() + getOvertime() + getAllowance() -
getDeduction() - getLeave());
}
public void Print()
{
System.out.println("Employee Id: " + geteId() + ", Employee Name: "
+ geteName() + ", Basic Salary: $" + String.format("%.2f",
getBasicSalary()) + "\n"
+ "Overtime: $" + String.format("%.2f", getOvertime()) + "\n"
+ "Allowance: $" + String.format("%.2f", getAllowance()) +
"\n"
+ "Deduction: $" + String.format("%.2f", getDeduction()) +
"\n"
+ "Leave: $" + String.format("%.2f", getLeave()) + "\n"
+ "Net Salary: $" + String.format("%.2f", getNetSalary()) +
"\n");
}
}
EmployeeMain.java (Main class)
import java.util.ArrayList;
import java.util.Scanner;
public class EmployeeMain {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
ArrayList<Employee> employees = new
ArrayList<>();
System.out.print("How many employees? ");
int n = Integer.parseInt(sc.nextLine().trim());
while(n <= 0)
{
System.out.println("Number of employees should be greater than
0!\n");
System.out.print("How many employees? ");
n = Integer.parseInt(sc.nextLine().trim());
}
System.out.println();
for(int i = 0; i < n; i++)
{
System.out.println("EMPLOYEE " + (i + 1) + ":\n-----------");
Employee emp = new Employee();
emp.Read();
emp.Calculate();
employees.add(emp);
System.out.println();
}
System.out.println("\nALL EMPLOYEE:\n"
+ "-------------");
for(Employee emp : employees)
emp.Print();
System.out.println();
}
}
*********************************************************** SCREENSHOT *****************************************************

a. Create a Payroll system in Java to do the following: Design a class employee with...
Create a class Payroll system in Java. Design a class employee with members eid, ename, basicsalary, overtime, allowance, deduction, leave ,net. ( basicsalary, overtime, allowance, deduction, leave ,net are all double values).Design the program for 3 employees(Array of Objects) Methods: Read() : Accept eid,ename and basicsalary from keyboard Calculate() : Peform the following:- Accept overtimehours and calculate overtime =( basic / 240 ) * overtimehours Accept housingallowance and other allowance and calculate allowance = housingallowance + other allowance Accept deductionhours...
In C++ Please please help.. Assignment 5 - Payroll Version 1.0 In this assignment you must create and use a struct to hold the general employee information for one employee. Ideally, you should use an array of structs to hold the employee information for all employees. If you choose to declare a separate struct for each employee, I will not deduct any points. However, I strongly recommend that you use an array of structs. Be sure to read through Chapter...
Draw the UML DIAGRAM ALSO
PLEASE DRAW THE UML DIAGRAM.ALSO
in java
should use the program in java
For this task you will create a Point3D class to represent a point that has coordinates in three dimensions labeled x, y and z. You will then use the class to perform some calculations on an array of these points. You need to draw a UML diagram for the class (Point3D) and then implement the class The Point3D class will have the...
Chapter 5 Assignment Read directions: In JAVA design and implement a class called Dog that contains instance data that represents the dog's name and dog's age. Define the Dog constructor to accept and initialize instance data. Include getter and setter methods for the name and age. Include a method to compute and return the age of the dog in "person years" (seven times age of dog. Include a toString method that returns a one-time description of the dog (example below)....
This is a java file and I am very confused on how to do this
project! please help!!
Specifications Overview: You will write a program this week that is composed of three classes: the first class defines Ellipsoid objects, the second class defines EllipsoidList objects, and the third, Ellipsoid ListApp, reads in a file name entered by the user then reads the list name and Ellipsoid data from the file, creates Ellipsoid objects and stores them in an ArrayList of...