Define the class Student which has the private members name, department, and mark. It has the public members set(), getMark(), get() (to get the student's name and department). print(), and a default parameterized constructor (with default values "Ali" as a name, "Physics" as a department, and 83 as a mark). Define a class called Section which has the private members title, length, and a pointer p of type Student. It has the public members set(), print(), and a default parameterized constructor (with default values "A" as a course title, and 12 students). The class also has a member function average() to find the section average, and a copy constructor. Implement the two classes Student and Section enforcing the least privileged principle. Read the following records fro the file "student.txt". Abass Physics Adel Computer Amal Engineering 87 43 63

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter11: Inheritance And Composition
Section: Chapter Questions
Problem 9PE
icon
Related questions
Question
100%
Define the class Student which has the private members name, department, and mark. It has the public
members set(), getMark(), get) (to get the student's name and department), print(), and a default parameterized
constructor (with default values "Ali" as a name, "Physics" as a department, and 83 as a mark).
Define a class called Section which has the private members title, length, and a pointer p of type Student. It has
the public members set), print(), and a default parameterized constructor (with default values "A" as a course
title, and 12 students). The class also has a member function average() to find the section average, and a copy
constructor.
Implement the two classes Student and Section enforcing the least privileged principle. Read the following
records fro the file "student.txt".
Abass Physics
Computer
Amal Engineering 87
43
Adel
63
The following driver produces the given sample output:
int main()
Section abc("Introduction to IT", 3);
abc.set("IT");
abc.print();
return 0:
Sample output:
IT has the following students:
Abass from the Physics department scored 43
Adel from the Computer department scored 63
Amal from the Engineering department scored 87
The section average is 64.3333
Transcribed Image Text:Define the class Student which has the private members name, department, and mark. It has the public members set(), getMark(), get) (to get the student's name and department), print(), and a default parameterized constructor (with default values "Ali" as a name, "Physics" as a department, and 83 as a mark). Define a class called Section which has the private members title, length, and a pointer p of type Student. It has the public members set), print(), and a default parameterized constructor (with default values "A" as a course title, and 12 students). The class also has a member function average() to find the section average, and a copy constructor. Implement the two classes Student and Section enforcing the least privileged principle. Read the following records fro the file "student.txt". Abass Physics Computer Amal Engineering 87 43 Adel 63 The following driver produces the given sample output: int main() Section abc("Introduction to IT", 3); abc.set("IT"); abc.print(); return 0: Sample output: IT has the following students: Abass from the Physics department scored 43 Adel from the Computer department scored 63 Amal from the Engineering department scored 87 The section average is 64.3333
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Software Development
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
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,