Here is code:
Employee.java:
public class Employee {
String lastName;
String firstName;
double hourlyWage;
int yearsWithCompany;
public Employee(String lastName, String firstName, double
hourlyWage, int yearsWithCompany) {
this.lastName = lastName;
this.firstName = firstName;
this.hourlyWage = hourlyWage;
this.yearsWithCompany = yearsWithCompany;
}
}
TestEmployee.java:
import java.util.*;
public class TestEmployee {
public static void main(String[] args) {
Employee[] employeeData = new Employee[100];
employeeData[0] = new Employee("Hadley", "Spraging", 15.63,
2011);
employeeData[1] = new Employee("Zulema", "Bottini", 19.11,
2011);
employeeData[2] = new Employee("Duffie", "Eccott", 66, 1997);
employeeData[3] = new Employee("Emery", "Ricardot", 64.41,
1997);
employeeData[4] = new Employee("Algernon", "Reggiani", 87.62,
1996);
employeeData[5] = new Employee("Sarena", "Tommen", 84.04,
2002);
employeeData[6] = new Employee("Charmian", "Monelli", 91.77,
2006);
employeeData[7] = new Employee("Micah", "Websdale", 26.04,
2007);
employeeData[8] = new Employee("Loreen", "Tant", 89.84,
2012);
employeeData[9] = new Employee("Kermie", "Myatt", 44.13,
1964);
employeeData[10] = new Employee("Tedda", "Davydkov", 96.57,
1980);
employeeData[11] = new Employee("Monika", "Ames", 90.85,
2006);
employeeData[12] = new Employee("Laney", "Strutz", 71.49,
2005);
employeeData[13] = new Employee("Beltran", "Cawley", 22.67,
2009);
employeeData[14] = new Employee("Peirce", "MacKartan", 21.8,
1994);
employeeData[15] = new Employee("Erek", "Fochs", 41.77,
1994);
employeeData[16] = new Employee("Elinore", "Wheatcroft", 12.34,
2011);
employeeData[17] = new Employee("Rube", "Ikin", 18.11, 1988);
employeeData[18] = new Employee("Goldie", "Pauls", 42.91,
1995);
employeeData[19] = new Employee("Carie", "Prayer", 91.43,
2006);
employeeData[20] = new Employee("Anthea", "Giacopazzi", 38.59,
1961);
employeeData[21] = new Employee("Salomo", "Inman", 80.92,
2011);
employeeData[22] = new Employee("Dorette", "Bradbury", 99.06,
2003);
employeeData[23] = new Employee("Celle", "Fawlkes", 57.54,
2005);
employeeData[24] = new Employee("Jilleen", "Coneau", 59.63,
1992);
employeeData[25] = new Employee("Fergus", "Abethell", 44.79,
2009);
employeeData[26] = new Employee("Hakeem", "Paunton", 60.78,
1996);
employeeData[27] = new Employee("Hastie", "Stainson", 65.15,
2007);
employeeData[28] = new Employee("Sofie", "Tabner", 78.65,
1986);
employeeData[29] = new Employee("Sacha", "Beldon", 31.39,
1987);
employeeData[30] = new Employee("Bryna", "Bartholomew", 67.36,
1995);
employeeData[31] = new Employee("Thorn", "Studders", 76.27,
2004);
employeeData[32] = new Employee("Rosabelle", "Mockler", 78.48,
2000);
employeeData[33] = new Employee("Penelopa", "Curnock", 55.22,
2011);
employeeData[34] = new Employee("Elwyn", "Calcut", 45.18,
2003);
employeeData[35] = new Employee("Cobbie", "Claris", 28.7,
1988);
employeeData[36] = new Employee("Mariette", "Waberer", 85.06,
1966);
employeeData[37] = new Employee("Karim", "Terrett", 58.18,
2010);
employeeData[38] = new Employee("Doralin", "Lettson", 11.92,
2002);
employeeData[39] = new Employee("Stephenie", "Barby", 63.07,
1993);
employeeData[40] = new Employee("Celle", "Buckoke", 77.07,
1992);
employeeData[41] = new Employee("Rourke", "Riccardi", 44.24,
2009);
employeeData[42] = new Employee("Krystyna", "Casino", 70.14,
1993);
employeeData[43] = new Employee("Park", "Swafford", 30.17,
1990);
employeeData[44] = new Employee("Alair", "Harbron", 37.47,
1992);
employeeData[45] = new Employee("Patrizia", "Jeffry", 69.46,
1996);
employeeData[46] = new Employee("Waly", "Braysher", 88.6,
1984);
employeeData[47] = new Employee("Foss", "Lathbury", 47.78,
2006);
employeeData[48] = new Employee("Fleur", "Lackemann", 49.7,
2003);
employeeData[49] = new Employee("Maybelle", "Filipovic", 48.41,
1959);
employeeData[50] = new Employee("Minta", "Herrieven", 96.48,
2000);
employeeData[51] = new Employee("Laurena", "Fittis", 54.74,
1988);
employeeData[52] = new Employee("Fields", "Windridge", 59.99,
2012);
employeeData[53] = new Employee("Rora", "McCurlye", 59.48,
2009);
employeeData[54] = new Employee("Redford", "Haggath", 32.4,
1997);
employeeData[55] = new Employee("Chelsea", "Verzey", 68.48,
1993);
employeeData[56] = new Employee("Barnebas", "Taks", 53.44,
2006);
employeeData[57] = new Employee("Helen", "Logue", 17.4,
1989);
employeeData[58] = new Employee("Thorn", "Jonathon", 47.17,
1994);
employeeData[59] = new Employee("Marve", "Roe", 44.98, 2001);
employeeData[60] = new Employee("Sophronia", "Flood", 96.72,
1968);
employeeData[61] = new Employee("Winni", "Argont", 87.39,
1987);
employeeData[62] = new Employee("Melosa", "Tomkowicz", 97.5,
2012);
employeeData[63] = new Employee("Jobina", "Simonot", 17.16,
1996);
employeeData[64] = new Employee("Lowe", "Brizell", 45.71,
1996);
employeeData[65] = new Employee("Cecilia", "Sells", 97.45,
2009);
employeeData[66] = new Employee("Wendie", "Ofer", 67.74,
2005);
employeeData[67] = new Employee("Gwendolen", "Farrear", 82.94,
2011);
employeeData[68] = new Employee("Kalinda", "Risbridger", 17.59,
1999);
employeeData[69] = new Employee("Natividad", "Hincks", 66.78,
1966);
employeeData[70] = new Employee("Marve", "Dawtry", 26.97,
1993);
employeeData[71] = new Employee("Chloette", "Gilmore", 14.33,
2007);
employeeData[72] = new Employee("Karlee", "Rowen", 78.23,
1994);
employeeData[73] = new Employee("Simmonds", "Ansill", 77.36,
2005);
employeeData[74] = new Employee("Natty", "Diplock", 22.75,
1987);
employeeData[75] = new Employee("Aron", "Bodham", 40.87,
2000);
employeeData[76] = new Employee("Phoebe", "Chinge de Hals", 24.28,
2004);
employeeData[77] = new Employee("Sibilla", "Licence", 58.25,
2005);
employeeData[78] = new Employee("Izaak", "Yakovliv", 77.92,
2012);
employeeData[79] = new Employee("Blair", "Axby", 36.47,
2010);
employeeData[80] = new Employee("Calley", "Brayson", 93.31,
2005);
employeeData[81] = new Employee("Levi", "Lithcow", 35.12,
2010);
employeeData[82] = new Employee("Hetty", "Kaaskooper", 97.72,
1994);
employeeData[83] = new Employee("Ottilie", "Hallsworth", 61.09,
1994);
employeeData[84] = new Employee("Fernande", "Hablot", 29.68,
1992);
employeeData[85] = new Employee("Jilleen", "Lavens", 67.13,
2006);
employeeData[86] = new Employee("Brew", "Pounder", 62.32,
1999);
employeeData[87] = new Employee("Felipa", "Winnister", 61.5,
2010);
employeeData[88] = new Employee("Lolly", "Cartmel", 92.79,
2007);
employeeData[89] = new Employee("Berte", "Meeke", 33.95,
2012);
employeeData[90] = new Employee("Allix", "Kamiyama", 82.49,
2005);
employeeData[91] = new Employee("Thurstan", "Volkers", 70.73,
1988);
employeeData[92] = new Employee("Reyna", "Kobes", 43.96,
1999);
employeeData[93] = new Employee("Alfy", "Moggach", 22.53,
2001);
employeeData[94] = new Employee("Tonie", "Lawson", 82.1,
2011);
employeeData[95] = new Employee("Daniela", "Gallimore", 65.78,
1985);
employeeData[96] = new Employee("Agathe", "Trussman", 77.77,
2005);
employeeData[97] = new Employee("Tandie", "Balden", 41.3,
2003);
employeeData[98] = new Employee("Quent", "Rawlcliffe", 56.69,
1999);
employeeData[99] = new Employee("John", "Chessell", 51.46,
2004);
int currentYear = Calendar.getInstance().get(Calendar.YEAR);
for (int i = 0; i < employeeData.length; i++) {
if (currentYear - employeeData[i].yearsWithCompany >= 20)
{
System.out.println(employeeData[i].firstName + ", " +
employeeData[i].lastName + ", $"
+ employeeData[i].hourlyWage);
}
}
}
}
Output:
Using Java: Question 2 (30 pts). Suppose that a class, Employee, is defined as follows: class...
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...
HOW TO FiX EXCEPTIONS??? In order to populate the array, you will need to split() each String on the (,) character so you can access each individual value of data. Based on the first value (e.g., #) your method will know whether to create a new Manager, HourlyWorker, or CommissionWorker object. Once created, populate the object with the remaining values then store it in the array. Finally, iterate through the array of employees using the enhanced for loop syntax, and...
Add an HourlyPlusCommissionEmployee class to the PayrollSystem app by subclassing an existing class. A HourlyPlusCommissionEmployee is a kind of CommissionEmployee with the following differences and specifications: HourlyPlusCommissionEmployee earns money based on 2 separate calculations: commissions are calculated by the CommissionEmployee base class hourly pay is calculated exactly the same as the HourlyEmployee class, but this is not inherited, it must be duplicated in the added class BasePlusCommissionEmployee inherits from CommissionEmployee and includes (duplicates) the details of SalariedEmployee. Use this as...
In JAVA #3 Write a program named nameChanger.java. This program will only have a driver class with a main. This program will have the user enter a series of names(first and last), which will then be stored in a String array. You will then change the values of each of the names in the array, so that they are stored lastname, firstname, and then output the revised array. Sample: Enter a name (first and last): Tonya Pierce Enter a name...
I need help with this one method in java. Here are the guidelines. Only public Employee[] findAllBySubstring(String find). EmployeeManager EmployeeManager - employees : Employee[] - employeeMax : final int = 10 -currentEmployees : int <<constructor>> EmployeeManager + addEmployee( type : int, fn : String, ln : String, m : char, g : char, en : int, ft : boolean, amount : double) + removeEmployee( index : int) + listAll() + listHourly() + listSalary() + listCommision() + resetWeek() + calculatePayout() :...
Create the Employee class: The Employee class has three attributes: private: string firstName; string lastName; string SSN; The Employee class has ▪ a no-arg constructor (a no-arg contructor is a contructor with an empty parameter list): In this no-arg constructor, use “unknown” to initialize all private attributes. ▪ a constructor with parameters for each of the attributes ▪ getter and setter methods for each of the private attributes ▪ a method getFullName() that returns the last name, followed by a...
C++ edit: You start with the code given and then modify it so that it does what the following asks for. Create an EmployeeException class whose constructor receives a String that consists of an employee’s ID and pay rate. Modify the Employee class so that it has two more fields, idNum and hourlyWage. The Employee constructor requires values for both fields. Upon construction, throw an EmployeeException if the hourlyWage is less than $6.00 or over $50.00. Write a program that...
Requirements: Your Java class names must follow the names specified above. Note that they are case sensitive. See our template below. BankAccount: an abstract class. SavingAccount: a concrete class that extends BankAccount. o The constructor takes client's firstname, lastname and social security number. o The constructor should generate a random 6-digit number as the user account number. o The initial balance is 0 and the annual interest rate is fixed at 1.0% (0.01).o The withdraw method signature...