Methods: Read() : Accept eid,ename and basicsalary from keyboard Calculate() : Peform the following:-
|
Print() :- Print all the members.
Java code for payroll system
import java.util.*;
class Employee{
private int eId;
private String eName;
private double basicSalary;
private double overTime;
private double allowance;
private double deduction;
private double leave;
private double net;
public void read(){ //method to get
details from user
double housingAllowance ;
double otherAllowance;
Scanner sc = new
Scanner(System.in); // to read input from user
System.out.println("Enter the Emplyee Id :");
eId =
sc.nextInt();
System.out.println("Employee name:");
eName =
sc.next();
System.out.println("Basic salary:");
basicSalary =
sc.nextDouble();
System.out.println("Housing allowance:");
housingAllowance
= sc.nextDouble();
System.out.println("Other allowance:");
otherAllowance =
sc.nextDouble();
System.out.println("Overtime hours:");
overTime =
sc.nextDouble();
System.out.println("Leaves taken:");
leave =
sc.nextDouble();
System.out.println("Deduction hours:");
deduction =
sc.nextDouble();
calculate(basicSalary,overTime,housingAllowance,otherAllowance,deduction,leave);
}
//method to calculate net salary
public void calculate(double basicSalary,double
overTimeHours,double housingAllowance,double otherAllowance,double
deductionHours,double leaveDays){
overTime = (basicSalary/240) *
overTimeHours;
allowance = housingAllowance +
otherAllowance;
deduction = (basicSalary/240) *
deductionHours;
leave = (basicSalary/30) *
leaveDays;
net = basicSalary + overTime +
allowance - deduction - leave;
}
//display details of employee
public void print(){
System.out.println("Employee name :"+eName);
System.out.println("Total allowance provided :
"+allowance);
System.out.println("Net Salary : "+net);
}
}
public class Main{
public static void main(String args[]){
Employee[] emp = new
Employee[3]; //array of three employees
for(int i=0;i<3;i++){
emp[i] = new Employee();
emp[i].read();
}
for(int
i=0;i<3;i++){
emp[i].print(); //print
details
}
}
}
Create a class Payroll system in Java. Design a class employee with members eid, ename, basicsalary,...
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...
Within c++ Create a simple Employee class with name, department, and title. Create an hourlyEmployee class (which inherits from the Employee class) for a basic payroll program to compute the net pay salary of hourly based employees. Your program should also find the average net pay for a small company. To define the class, include the appropriate data members, member functions, constructors, and access modifiers. For simplicity, use a constant tax rate of 30% to compute the tax amount. Employees...
Create another Java class named EmployeeMain within the same project, which includes the main method. a. Include another class named Employee in the same Java file. This class has the following instance variables and instance methods. Define all the instance/static variables with private access modifier and constructors, instance/static methods with public access modifier. Instance Variables empID: int employeeName: String basicSalary: double Constructor Set the value for empID. Instance Methods Get and set methods for all instance variables. displayEmployee: Display the...
in Java Create a custom class Employee with field like name , empNo and salary. a. Create 5 objects b. Add all objects to ArrayList c. Print all employee details from ArrayList . d. Remove employee having salary less than 5000 $ [12] e. Insert a new employee object with more salary value at same index at which other object was removed. *
Please write in C# and create a UML design. 1. Create an Employee class. Items to include as data members are employee number, first name, last name, and monthly salary. Include default and overloading constructors , also include a method that calculates the annual pay of the employee, and a method to display the information of the employee. Create a second class to test your Employee class by instantiating two Employee objects and display all the above information of each...
[JAVA] Program: Design a Ship class that the following members: A field for the name of the ship (a string) o A field for the year the the ship was built (a string) o A constructor and appropriate accessors and mutators A toString method that displays the ship's name and the year it was built Design a CruiseShip class that extends the Ship class. The CruiseShip class should have the following members: A field for the maximum number of passengers...
IN JAVADesign a Payroll class with the following fields:• name: a String containing the employee's name• idNumber: an int representing the employee's ID number• rate: a double containing the employee's hourly pay rate• hours: an int representing the number of hours this employee has workedThe class should also have the following methods:• Constructor: takes the employee's name and ID number as arguments• Accessors: allow access to all of the fields of the Payroll class• Mutators: let the user assign values...
Design an algorithm using RAPTOR that will produce an employee payroll register from an employee file. Each input employee record contains the employee number, gross pay, income tax payable, union dues and other deductions. Your program is to read the employee file and print a detail line for each employee record showing employee number, gross pay, income tax payable, union dues, other deductions and net pay. Net pay is calculated as gross pay – income tax – union dues –...
In Java: Executable Class create an array of Employee objects. You can copy the array you made for Chapter 20. create an ArrayList of Employee objects from that array. use an enhanced for loop to print all employees as shown in the sample output. create a TreeMap that uses Strings for keys and Employees as values. this TreeMap should map Employee ID numbers to their associated Employees. process the ArrayList to add elements to this map. print all employees in...
c++ only Design a class representing an Employee. The employee would have at least these private fields (Variables): name: string (char array) ID: string (char array) salary: float Type: string (char array) All the variables except for the salary should have their respective setters and getters, and the class should have two constructors, one is the default constructor and the other constructor initializes the name,ID and type of employee with valid user input. The class should have the following additional...