Question
Define a Java class namely Employee containing: Instance variables: - id: A private instance variable of type integer. - name: A private instance variable of
Define a Java class namely Employee containing: Instance variables: - id: A private instance variable of type integer. - name: A private instance variable of type String. - salary: A private instance variable of type double. - workedHour: A private instance variable of type double. Methods: - full-parameterized constructor: a constructor method to initialize the instantiated objects.
setname( xxx ): acts as the set method for the attribute name - setid(xxx): acts as the set method for the attribute id - setsalary(xxx): acts as the set method for the attribute salary - setworkedHour(xxx): acts as the set method for the attribute workedHour. - getname (): acts as the get method for the attribute name - getid (): acts as the get method for the attribute id - getsalary (): acts as the get method for the attribute salary - getworkedHour (): acts as the get method for the attribute workedHour. - display(): print the attributes id, name, and salary in the following format: id" ,"name", "salary".
Define a Java class TestEmployee that contains a main method and test the functionality of the above class Employee - Create three objects of type Employee
Name of object id name workedHour salary El 1001 Mohammed 44 2000 E2 1002 Omar 38 4000 E3 1003 Khaled 45 5400
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