Assignment 2
Assignment 2
[No static initialization will be allowed. Any input must be through the constructor functions and
the output through the member functions.]
2. Write a C++/Java program that uses reference variables as arguments to swap the values of
a pair of integers using the concepts of class and objects. [No static initialization will be allowed.
Any input must be through the constructor functions and the output through the member
functions.]
3. Write a C++/Java program that performs basic arithmetic operations using the concepts of
class and objects. [No static initialization will be allowed. Any input must be through the
constructor functions and the output through the member functions.]
4. Write a C++/Java program that handles the students’ records using the concepts of class and
objects. [No static initialization will be allowed. Any input must be through the constructor
functions and the output through the member functions.]
5. Write a C++/Java program that calculates the GPA for students using the concepts of class
and objects. [No static initialization will be allowed. Any input must be through the constructor
functions and the output through the member functions.]
6. Write a C++/Java program that calculates the CGPA for students using the concepts of class
and objects. [No static initialization will be allowed. Any input must be through the constructor
functions and the output through the member functions.]
7. Write a C++/Java program that checks whether a given integer prime or not using the
concepts of class and objects. [No static initialization will be allowed. Any input must be through
the constructor functions and the output through the member functions.]
8. Write a C++/Java program that finds the factorial of a given number using the concepts of
class and objects. [No static initialization will be allowed. Any input must be through the
constructor functions and the output through the member functions.]
9. Write a C++/Java program that calculates the summation of any given series of numbers
using the concepts of class and objects. [No static initialization will be allowed. Any input must
be through the constructor functions and the output through the member functions.]
10. Write a C++/Java program that uses static data members using the concepts of class and
objects. [No static initialization will be allowed. Any input must be through the constructor
functions and the output through the member functions.]
11. Write a C++/Java program that uses static member functions using the concepts of class and
objects. [No static initialization will be allowed. Any input must be through the constructor
functions and the output through the member functions.]
12. Write a C++/Java program that implements the concept of constructor overloading.
13. Write a C++/Java program that implements the concept of copy constructor.
14. Write a C++/Java program that implements the concept run-time function overloading.
15. Write a C++/Java program that implements the concept of constructor with default
arguments.
16. Write a C++/Java program that implements the concept of destructor.