You are on page 1of 1

KIE1008 (Programming Tutorial) Session 2016/2017 (Semester 2)

Tutorial 0: Object-Oriented Programming (Classes Revision & Composition)

Write a program to record the information about courses offered by a university.

Create class course that records the course’s name and code. Create the appropriate accessor and
mutator functions. Also, create a friend function that display the course info.

Create class lecturer that records a lecturer’s position (Professor/Associate Professor/Senior


Lecturer/Lecturer) and name. Create the appropriate accessor, mutator and utilization functions.

Create class student that records a student’s name, ID, mark and grade. Create the appropriate
accessor, mutator and utilization functions.

Create a class called core that contains course, lecturer and an array of 10 students as private
data. Create the appropriate accessor, mutator and utilization functions.

Create main() that declares a core course, then prompt the user to key in the students’ info (name and
ID).

Enter Student 1’s name:


Enter Student 1’s ID:
Enter Student 2’s name:
Enter Student 2’s ID:

Write a function to randomly assign marks (0-100) for the students, and the grade is then calculated
automatically.

Lastly, display the info as follows:

Gradebook for KIE1008: Programming II


Lecturer: Chow Chee Onn (Position: Associate Professor)
1. John Lee (KIX160001) 70 (B)
2. Mohd. Amin (KIX160002) 80 (A)
3. Siti Rohani (KIX160003) 90 (A+)

Note: the first line is printed using the friend function, second line is printed by function inside class
lecturer, and each student info is printed by function inside class student.

Some of the design criteria are not given, use your creativity to design the program.

Extra: Let’s say the number of students is not fixed at 10, use a const variable to keep track of the
number of students.

---END---

You might also like