Sunteți pe pagina 1din 3

AMRITA VISHWA VIDYAPEETHAM

AMRITA SCHOOL OF ARTS AND SCIENCES, MYSORE


Academic year: 2015 - 2016
Lab Cycle BCA II Semester
Course Code: 15CSA191

Course Title: Object Oriented Programming using C++ Lab

Lab Cycle 1
1. Write a C++ program to print hello message.
2. Write a program that takes length as input in feet and inches. The program should then
convert the lengths in centimeters and display it on screen.
3. Read an integer number of a fixed length (3 digits) from the standard input then print its
digits separated by spaces. For example if 364 is the input then the output should be 3 6 4
or 4 6 3 Hint: Use division and modulus operator.
4. Write a program to read three integer numbers then find and print the largest one among
these numbers.
5. Body Mass Index Calculator (BMI) calculator formulas for calculating BMI is:
BMI=weight/(height)2
Create a BMI calculator application that reads the users weight and height then
calculates
and displays the users body mass index.
Print Underweight if the BMI result is less than 18.5
Print Normal if the BMI result is between 18.5 and 24.9
Print Overweight if the BMI result is between 25 and 29.9
Print Obese if the BMI result is 30 or greater
6. Find the roots of a quadratic equation.
7. Find whether given number is prime or not.
8. Find the reverse of a given number.
9. Sort the elements in a given array, using bubble sort.
10. Find the product of two matrices of sizes 3 x 4 and 4 x 3.
11. Find the number of vowels and letters in a given string.
Lab Cycle 2
12. Write a C++ Program to implement a sphere class with appropriate members
and member function to find the surface area and the volume. (Surface = 4 r2 and
Volume = 4/ 3 r3 )
13. Write a program to demonstrate access specifiers in C++.
14. Define a class REPORT with the following specification:
Private members :
adno
4 digit admission number
name
20 characters
marks
an array of 5 floating point values

average
average marks obtained
GETAVG()
a function to compute the average obtained in five subject
Public members:
READINFO() function to accept values for adno, name, marks. Invoke the function
GETAVG(). DISPLAYINFO() function to display all data members of report on the screen.
You should give function definitions.
15. Write a C++ program to implement a telephone bill class with Name, Address, Tel. No.,
No. of calls as data members. Compute the amount to be paid if the charges per call is
Rs. 2/-.
16. Write a C++ program to implement Bank-SB-Account Class with member functions to
deposit, withdraw and show the balance. Assume appropriate data members.
17. Consider a shopping list of different items for which places an order with a dealer. This
list includes details such as the code and the price of each item. Perform operations
such as adding an item to the list, deleting an item from a list and printing the total value
of the order. Write a program where the item code and price are arrays.

18. Write a class distance which contains data members feet and inches, perform operations
to get the distance and display the total distance. Create at least 10 objects using array of
objects.
19. Write a program to demonstrate this pointer.
20. Write an overloaded function to calculate and return the area of a square, a circle ,a
rectangle. Then call it from the main function.
21. Write a program which has an inline Function Overloading Using Default Arguments and
User Input.
22. To write a c++ program for complex numbers using operator overloading
23. Write a C++ program to implement flight class with data member as flight no.,
source, destination and fare. Write a copy constructor and a member function to display
the flight information
24. Write a C++ program to implement user defined string class. Overload the constructor
and a member function to concatenate two strings.
25. Write a C++ program to implement a class to represent complex numbers. Include
member functions to add and multiply two complex numbers. Overload assignment
operator =
26. Write a C++ program to implement time class that has separate data members for hours,
minutes and seconds. Overload + Operator to add two times (object) and ++ operator to
increment the time by one second.
27. Write a C++ program to implement a student class having roll no.name, rank, addresses
as data members. Overload assignment operator =
Lab Cycle 3
28. Create a Box class which contains width and height. Using a Friend function printwidth
display the width of the box object.

29. Consider a class Rectangle which is a friend of class Square allowing Rectangle's
member functions to access private and protected members of Square
30. Write three derived classes inheriting functionality of base class person (should have a
member function that ask to enter name and age) and with added unique features of
student, and employee, and functionality to assign, change and delete records of student
and employee. And make one member function for printing address of the objects of
classes (base and derived) using this pointer. Create two objects of base class and derived
classes each and print the addresses of individual objects. Using calculator, calculate the
address space occupied by each object and verify this with address spaces printed by the
program.
31. Write a C++ program to use pointer for both base and derived classes and
call the member function. Use Virtual keyword.
32. Write a C++ program to implement the concept of Virtual functions

33. Write a program to implement pure virtual function and abstract class.
34. Write a program that creates a binary file by reading the data for the students from the
terminal. The data of each student consist of roll no., name (a string of 30 or lesser no. of
characters) and marks.

S-ar putea să vă placă și