Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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=IwhStep 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