CS2810 OOAIA: A6 solved

$35.00

Category: You will receive a download link of the .ZIP file upon Payment

Description

5/5 - (1 vote)

Create a class in C++ for representing the students. The class should have
following attributes.
• Name of the student (may contain duplicates)
• Roll number (Unique integer)
• Scores they get in three subjects(Physics, Chemistry, Maths)
• some other supportive attributes of your choice
There are 3 type of operations to perform using only Functors.
1. Find student details, given the roll number
2. Find all the students given the name. Return the students sorted by the
roll number.
3. Find the average score of all the students. Return the students sorted first
by the decreasing average score then by the roll number.
3 Input Format
First line contains the number of students n.
Following n lines will have the details of each student in the given form
hnameihspaceihrollno.ihspaceihP hysicsmarksihspaceihChemistrymarksihspaceihM athsmarksi
After which a single operation number is given along with input required for
particular operation.
1
4 Output Format
• For operation 1: print the details of the student with given roll number,
same as in input format. In case of roll number not present in input print
”Invalid Entry”
• For operation 2: print the details of the students in separate lines with
the given name in separate lines, sorted according to their roll numbers.
In case of name not present in input print ”Invalid Entry”
• For operation 3: print the details of the students along with the average
marks in separate lines, sorted in decreasing order of average marks then
by the roll number. (print average marks to four decimal place).
5 Constraints
Number of students(n): 1 ≤ n ≤ 100
Subject marks(m): 0 ≤ m ≤ 100
Roll number (r): 1 ≤ r ≤ 100
6 Sample Testcase
Input 1:
5
Akshay 14 78 85 67
Sahil 32 89 76 90
Suzain 36 56 71 65
Priya 29 89 80 99
Sonu 39 84 75 95
1 38
Output 1:
Invalid Entry
Input 2:
8 Akshay 14 78 85 67
Sahil 32 89 76 90
Priya 29 89 80 99
Sonu 39 84 75 95
Akshay 15 65 80 74
Manav 23 59 83 70
Akshay 13 78 67 85
Shubham 34 92 85 95
2 Akshay
Output 2:
2
Akshay 13 78 67 85
Akshay 14 78 85 67
Akshay 15 65 80 74
Input 3:
10
Akshay 14 78 85 67
Sahil 32 89 76 90
Suzain 36 56 71 65
Priya 29 89 80 99
Sonu 39 84 75 95
Akshay 15 65 80 74
Manav 23 59 83 70
Akshay 13 78 67 85
Sahil 31 67 76 86
Shubham 34 92 85 95
3
Output 3:
Shubham 34 92 85 95 90.6667
Priya 29 89 80 99 89.3333
Sahil 32 89 76 90 85.0000
Sonu 39 84 75 95 84.6667
Akshay 13 78 67 85 76.6667
Akshay 14 78 85 67 76.6667
Sahil 31 67 76 86 76.3333
Akshay 15 65 80 74 73.0000
Manav 23 59 83 70 70.6667
Suzain 36 56 71 65 64.0000
7 Design submission format
For the design submission on Moodle, please submit tar.gz file named as your
roll number.
3