Answered step by step
Verified Expert Solution
Question
1 Approved Answer
hi can you help me with this question thank you Description What you are Provided You are provided with a class to represent an Employee
hi can you help me with this question thank you
Description
What you are Provided
You are provided with a class to represent anEmployee. That includes the following:
- Attributes for the Employee'sname(String),jobTitle(String),salary(float) and auniqueemployeeID(int). The salary should have a minimum value of 19000f.
- A default constructor which should set default values for all attributes.
- A general constructor which accepts and sets values for each of the attributes.
- Getter and setter methods for the name, jobTitle and salary.
- A Getter method for the employeeID.
- A method calledshowEmp()that takes no parameters, returns nothing and prints the information for each employee to the screen. (See sample output below for format, in bold).
- A method calledtoString()that returns a String representation of the attributes of an Employee (see sample output below for format, in italics).
Part A:
make a main method in a new class calledTestEmployeeand in this method:
- Declare 3 Employee objects. Use the General Constructor for the first 2 Employees and the default constructor for the last employee. Details for Employee 1 and 2 are as follows:Tom DalyTeacher45000Mary MurphyDeveloper30000
- Call thegetName(),getJobTitle(),getSalary()andgetEmployeeID()methods to print the information of the 2nd Employee to the screen (it should be displayed exactly as the sample output below).
- Call thesetName(<...>),setJobTitle(<...>)andsetSalary(<...>)method to change the information of the 3rd Employee. Use the following details:
- Name = Michael Higgins
- jobTitle = President
- Salary = 1000
- Use theshowEmp()method to print all the information for all Employees to the screen (it should be displayed exactly as the sample output below).
- Call thetoString()method on the 1st Employee object.
Output
TheTestEmployeeclass should print to the screen the correct message to match each question given above.
Sample Output - output should be exactly as below:
Employee 2 is called Mary Murphy They are a Developer Their salary is 30000.0 Their Employee ID number is 1002 Entered salary of 1000.0 is too low. Salary set at minium wage of 19000.0 EMPLOYEE RECORD NAME: Tom Daly JOB TITLE: Teacher CURRENT SALARY: 45000.0 EMPLOYEE ID: 1001 EMPLOYEE RECORD NAME: Mary Murphy JOB TITLE: Developer CURRENT SALARY: 30000.0 EMPLOYEE ID: 1002 EMPLOYEE RECORD NAME: Michael Higgins JOB TITLE: President CURRENT SALARY: 19000.0 EMPLOYEE ID: 1003 NAME: Tom Daly JOB TITLE: Teacher CURRENT SALARY: 45000.0 EMPLOYEE ID: 1001
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started