You are on page 1of 1

Assignment- Constructors

1. Write a program to design a class Volume and then find out the volume of
a Cube, Cylinder and Sphere using constructor overloading.

2. Create a complex class with data members as real and imaginary.


Overload three constructors to initialize the data members (i.e. default,
normal, and through object initialization).Provide methods which returns
object of the complex class as the result for addition, subtraction,
multiplication of two complex numbers.

3. Write a java class which consists of 5 integer data. Overload constructor


(Default & normal) to initialize those integer data members. Provide a
method which sorts those integer data members using bubble sort.

4. Program that creates class Square and assigns values to variables using
constructor and this keyword.

5. Program that illustrates how this keyword can be used by one constructor
to explicitly invoke another constructor in the same class.

6. WAP that will allows the user to enter CD information - Artist name,
album title, and year of release -- and then organizes it according to the
user's choice and criteria -- either by artist name, then title, then year of
release, or by any other order according to the user's choice.

You might also like