C++ Programming- LAB Assignment
BCA 2nd Year 3rd Semester
Assigement-3
Encapsulation
1. A mathematical research and implementation institute needs to take a
number from user. It is required to multiply the data by 2 if it is a
palindrome number. Otherwise it needs to divide by 2 and display the
output. For security reasons, the data must be encapsulated.
Test case-1:
Input:
Enter the data: 161
Output:
It is Palindrome number, so final result is 322
Test case-2:
Input:
Enter the data: 244
Output:
It is Palindrome number, so final result is 122
2. A college requires storing information like roll, name, age and marks of 3
different subjects about each student of BCA 3rd semester. It is required to
find out the total and average marks of each student along with details of
all students . Assume there are three students in BCA 3rd semester. Model
above problem using object oriented flavor.
Test case:
Input:
Roll Name age m1 m2 m3
Student-1 1 Rohan 19 81 67 78
Student-2 2 Saikat 20 34 56 81
Student-3 3 manoj 19 45 56 46
Output:
Details of All student
ROLL NAME AGE SUB-1 SUB-2 SUB-3
1 Rohan 19 81 67 78
2 Saikat 20 34 56 81
3 Monaj 19 45 56 46
Total marks of Student-1 is: 226
Average marks of student-1 is: 75.33
Total marks of Student-2 is: 171
Average marks of student-2 is: 57.00
Total marks of Student-3 is: 147
Average marks of student-3 is: 49.00
3. A college requires storing information like roll, age and marks of 5
subjects about each student of BCA 3rd semester. It is required to find out
the topper of the BCA 3rd semester. Assume there are five students in BCA
3rd semester. Model above problem using object oriented flavor.
Test case:
Input
Roll Name age m1 m2 m3
Student-1 1 Rohit 19 81 67 78
Student-2 2 Binoy 20 34 56 81
Student-3 3 Mohit 19 45 56 46
Output
Topper of the BCA 3rd semester
Highest Marks=226
Roll Number of Highest Scorer=1
Age of Highest Scorer=19