Design a struct personallnfo with components id, and name of type string. Design a class student with private data member's person (struct variable of type personalinfo), numberOfCourses (of type integer), average (of type float), and marks[] an array of student's marks of type integer. The class also has the member functions ser(), getPerson( ), print(), findAverage(), getAverage(), and a parameterized constructor with default value 1 for the number of courses. Implement the member functions of the class student. The member function findAverage() is used to calculate the average mark for each student. I Write a driver that does the following: Declares the array section[] of objects of student type. Reads the number of students. Reads information for each student from the file student.txt. Calls the user-defined function int maxAverageIndex(int, student []) Prints the id and name of the student with the maximum average. Student.txt: 1463491 Als 72 65 81 85 1370005 Yousef $91 82 94 75 87 5437330 Asna 68 72 63 2600004 Abrar 4 52 83 74 66 1300002 Sadiq 3 2 72 61 Sample input/output: 5 Student Ali with id 1463491 has average 75.75 of 4 courses. Student Yousef with id 1370005 has average 85.8 of 5 courses. Student Amna with id 5437330 has average 67.6667 of 3 courses. Student Abrar with id 2600004 has average 68.75 of 4 courses. Student Sadiq with id 1300002 has average 66.5 of 2 courses. Student 1370005 Yousef has the maximum average.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Design a struct personalinfo with components id, and name of type string.
Design a class student with private data member's person (struct variable of type personalInfo),
number Of Courses (of type integer), average (of type float), and marks[] an array of student's marks of
type integer. The class also has the member functions ser( ), getPerson(), print(), findAverage(),
getAverage(), and a parameterized constructor with default value 1 for the number of courses.
Implement the member functions of the class student.
The member function findAverage() is used to calculate the average mark for each student.
I
Write a driver that does the following:
Declares the array section[ ] of objects of student type.
Reads the number of students.
Reads information for each student from the file student.txt.
Calls the user-defined function
int maxAverageIndex(int, student [])
Prints the id and name of the student with the maximum average.
Student.txt:
4
1463491 Ali
72 65 81 85
1370005 Yousef 5 91 82 94 75 87
5437330 Anna
68 72 63
2600004 Abrar 4 52 83 74 66
1300002 Sadiq 2 72 61
3
Sample input/output:
5
Student Ali with id 1463491 has average 75.75 of 4 courses.
Student Yousef with id 1370005 has average 85.8 of 5 courses.
Student Amna with id 5437330 has average 67.6667 of 3 courses.
Student Abrar with id 2600004 has average 68.75 of 4 courses.
Student Sadiq with id 1300002 has average 66.5 of 2 courses.
Student 1370005 Yousef has the maximum average.
Transcribed Image Text:Design a struct personalinfo with components id, and name of type string. Design a class student with private data member's person (struct variable of type personalInfo), number Of Courses (of type integer), average (of type float), and marks[] an array of student's marks of type integer. The class also has the member functions ser( ), getPerson(), print(), findAverage(), getAverage(), and a parameterized constructor with default value 1 for the number of courses. Implement the member functions of the class student. The member function findAverage() is used to calculate the average mark for each student. I Write a driver that does the following: Declares the array section[ ] of objects of student type. Reads the number of students. Reads information for each student from the file student.txt. Calls the user-defined function int maxAverageIndex(int, student []) Prints the id and name of the student with the maximum average. Student.txt: 4 1463491 Ali 72 65 81 85 1370005 Yousef 5 91 82 94 75 87 5437330 Anna 68 72 63 2600004 Abrar 4 52 83 74 66 1300002 Sadiq 2 72 61 3 Sample input/output: 5 Student Ali with id 1463491 has average 75.75 of 4 courses. Student Yousef with id 1370005 has average 85.8 of 5 courses. Student Amna with id 5437330 has average 67.6667 of 3 courses. Student Abrar with id 2600004 has average 68.75 of 4 courses. Student Sadiq with id 1300002 has average 66.5 of 2 courses. Student 1370005 Yousef has the maximum average.
Expert Solution
steps

Step by step

Solved in 4 steps with 4 images

Blurred answer
Knowledge Booster
Reference Types in Function
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education