The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Jul 2017 |
| Last Sign in: | 304 Weeks Ago, 6 Days Ago |
| Questions Answered: | 15833 |
| Tutorials Posted: | 15827 |
MBA,PHD, Juris Doctor
Strayer,Devery,Harvard University
Mar-1995 - Mar-2002
Manager Planning
WalMart
Mar-2001 - Feb-2009
Employee:
a) Write a class to represent an Employee. This should include the following:
i). Attributes for the Employee’s name (String), jobTitle (String), salary (float) and a unique employeeID (int). The salary should have a minimum value of 19000f.
ii). A default constructor which should set default values for all attributes.
iii). A second constructor which accepts and sets values for each of the attributes.
iv). Getter and setter methods for the name, jobTitle and salary.
v). A Getter method for the employeeID
vi). A method called showEmp() that takes no parameters, returns nothing and prints the information for each employee to the screen. (See sample output below).
vii). A method called toString()that returns a string representation of the attributes of an Employee (see sample output below for format)
b) Write a main method in a new class called TestEmployee and in this method: i). 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: Num Name jobTitle salary 1 “Tom Daly” “Teacher” 45000 2 “Mary Murphy” “Developer” 30000
ii). Call the getName(), getJobTitle(), getSalary() and getEmployeeID() methods to print the information of the 2nd Employee to the screen (it should be displayed exactly as the sample output below).
iii). Call the setName(<…>), setJobTitle(<…>) and setSalary(<…>) method to change the information on the 3rd Employee to the following details:
Num Name jobTitle salary 3 “Michael Higgins” “President” 1000
iv). Use the showEmp() method to print all the information for all People to the screen (it should be displayed exactly as the sample output below).
v). Call the toString() method on the 1st Employee object.
(See attached)
----------- ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly