Question: Object-oriented Programming Question 1 (a) Define a service class called Employee that has 3 data members, id, name and department. The class has a constructor

 Object-oriented Programming Question 1 (a) Define a service class called Employeethat has 3 data members, id, name and department. The class has Object-oriented Programming

Question 1 (a) Define a service class called Employee that has 3 data members, id, name and department. The class has a constructor to initialize all data members through the constructor's parameters, getter and setter methods for all data members and a toString() method which returns a satring that contains all object's data members. (b) Write a main class to create one object from the above class and test all the method created in the class. Question 2 Define a programmer-defined class named Cuboid that contains 3 instance variables - length (I), width (w) and height (h) of a cuboid. The class also includes getter and setter methods for each instance variables and methods perimeter(), area() and volume() which return perimeter, total surface are and volume of the cuboid respectively. Write also 2 constructors for the class - one with no-arg and second with 3 arguments for all instance variables. Formula for: Perimeter=4(I+w+h)Totalsurfacearea=2(Iw+wh+hl)Volume=Iwh Write a main class that creates two Cuboid objects which values are obtained from user input. The program then display the perimeter, the total surface area and the volume of both objects. It also specifies that which object is bigger than the other object based on their volume

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!