Payroll.java
public class Payroll {
private int[] employeeId = { 5658845, 4520125,
7895122, 8777541, 8451277, 1302850, 7580489 };
private int[] hours = new int[7];
private double[] payrate = new double[7];
private double[] wages;
/**
* Iterates through the wages array setting each
element to the product of its corresponding
* values in the hours and payRate arrays.
*/
public void calculateWages()
{
wages = new double[7];
for (int index = 0; index < 7;
index++)
{
wages[index] =
hours[index] * payrate[index];
}
}
public int getEmployeeId(int index)
{
return employeeId[index];
}
public int[] getHours()
{
return hours;
}
public int getHours(int index)
{
return hours[index];
}
public double[] getPayrate()
{
return payrate;
}
public double getPayrate(int index)
{
return payrate[index];
}
/**
* Finds the wage of an employee and returns it.
*
* @param id The employee's ID
* @return The wage of the employee whose ID was given.
Returns -1 if no employee was found.
*/
public double getWage(int id)
{
for (int index = 0; index < 7;
index++)
{
if (id ==
employeeId[index])
{
return wages[id];
}
}
return -1;
}
public double[] getWages()
{
return wages;
}
public double getWages(int index)
{
return wages[index];
}
public void setEmployeeId(int index, int
employeeId)
{
this.employeeId[index] =
employeeId;
}
public void setHours(int index, int hours)
{
this.hours[index] = hours;
}
public void setPayRate(int index, double
payRate)
{
this.payrate[index] =
payRate;
}
public void setWages(int index, double wages)
{
this.wages[index] = wages;
}
}
With Java Language: In this assignment, you are to create a class named Payroll. In the...
I was wondering if I could get some help with a Java Program
that I am currently working on for homework. When I run the program
in Eclipse nothing shows up in the console can you help me out and
tell me if I am missing something in my code or what's going
on?
My Code:
public class Payroll {
public static
void main(String[] args) {
}
// TODO Auto-generated method stub
private int[] employeeId = {
5658845, 4520125, 7895122,...
java Payroll class Exceptions Programming Challenge 5 of Chapter 6 required you to write a Payroll class that calculates an employee’s payroll. Write exception classes for the following error conditions: • An empty string is given for the employee’s name. • An invalid value is given for the employee’s ID number. If you implemented this field as a string, then an empty string would be invalid. If you implemented this field as a numeric variable, then a negative number or...
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...
Suppose you were given the job to write a Java class to manage employee payroll information in an HR management system. Each employee will be modeled as a single EmployeePayroll object (much like the Student objects discussed in class). The state of the EmployeePayroll object includes the first name and last name of the employee, a unique 15 digit employee number for each employee, a number of hours that they've worked this week (which could be a fraction of an...
Define a class named Employee . Derive this class from the class Person. An employee record inherits an employee's name from the class Person. In addition, an employee record contains an annual salary (represented by a single value of type double), a hire date that gives the year hired (as a single value of type int), an identification number of type int, and a department of type String. Give your class a reasonable complement of constructors, accessors, mutators, an equals...
Given attached you will find a file from Programming Challenge 5 of chapter 6 with required you to write a Payroll class that calculates an employee’s payroll. Write exception classes for the following error conditions: An empty string is given for the employee’s name. An invalid value is given to the employee’s ID number. If you implemented this field as a string, then an empty string could be invalid. If you implemented this field as a numeric variable, then a...
Create a Java application, that support the following: Create an Employee class, which holds following information: Employee First Name Employee Last Name Employee Phone Number Employee Address Employee id Employee Title Employee salary Create an application that uses the Employee class Constructors –Getters and setters A minimum of 3 constructors including default constructor equals() method Helper methods toString() method Create an array of 5 Employee objects Use a Scanner to read in 5 employee information Change 2 employees information (3-items...
1) (10 points) Create a new Java project, name it "Quiz02". Create a java class Traveler that has four data members, String name, Date bDate, int id and int noOfDependens. Generate the following: 1- Getters and Setters. 2- Four parametrize constructor to initialize the four data members above. 3- toString() method. Create a java class Flight that has four data members, String number, String destination, int capacity, and ArrayList<Traveler> travelers. • Notel - travelers will be used to track the...
Use python to create this program.
1) Employee Class Write an Employee class that keeps data attributes for the following pieces of information: Note: For all classes, the attributes must be hidden Employee Name Employee Number Hire Date Create accessors and mutators Attributes should be hidden. Create a class attribute that determines a standard pay rate adjustment 4% for raises 2) ProductionWorker Class Write a class named ProductionWorker that is a subclass of Employee that holds the following attributes .Shift...
Write code to create a Java class called "Student". The class should hold information about a student: name, id and whether or not the student is currently registered. There should be a constructor that takes name, id and registration status. Add getters and setters for the three properties. Make sure that you use appropriate visibility modifiers (public vs. private).