Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed 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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data And Information Quality Dimensions, Principles And Techniques

Authors: Carlo Batini, Monica Scannapieco

1st Edition

3319241060, 9783319241067

More Books

Students also viewed these Databases questions

Question

Tell the merits and demerits of Mendeleev's periodic table.

Answered: 1 week ago

Question

7. How might you go about testing these assumptions?

Answered: 1 week ago