Create three classes program in cpp, C/C++ Programming

Assignment Help:

In this worksheet you are asked to write three classes in C++: Lecture class, Course class and University class. The classes relate to each other in the way that a Course has many Lectures and a University has many Courses. Please keep in mind that this academic setting is just for practising certain aspect of C++ and contains many simplification regarding real life.

The main aim in this worksheet is to practice dynamic memory allocation within classes, constructors, destructors, deep copies and overwriting of operators.

Exercise 1, the Lecture class

For the purpose of this assessment a Lecture has a log containing any change in student numbers. For example a log sequence of 10, -2, 4 means the student attendance increased by 10 then reduced by 2 and increased again by 4 (latecomers eh?).

The Lecture.hpp is already written and so are large part of Lecture.cpp. Your task is to extend the Lecture.cpp file and write the destructor, the copy method and the copy constructor as well overwriting the assignment operator so that a deep copy mechanism is followed.

Exercise 2, the Course class

A Course has a name and any number of Lectures.

Again the header file and large parts of this class are already provided. Your task is to write the destructor, the copy method and the copy constructor as well overwriting the assignment operator so that a deep copy mechanism is followed. Note that these need also be added to the header file. Finally you need to write the addLecture(Lecture c) method. This method will attach the given Lecture to the Course. As arrays are used to store the Lectures, you have to be careful when the currently used array is full.

Exercise 3, the University class

The University class contains any number of Courses. Here no partial written files are given. Please make sure you call your files University.hpp and University.cpp. A part from the constructor, copy constructor, destructor, copy method, and overwriting of the assignment operator class 2 additional methods.

addCourse
This method takes a Course as its parameter and adds the Course to the Courses stored by the class.

listAll
This method prints via cout the details of all stored Courses. The information is taken from the toString method of the Course class.

Your task to write the University class. To store any number of Courses you should use dynamically allocated array of Courses. You will need to create larger arrays when the previous one is getting too small. Note that the University class should follow the deep copy mechanism.


Related Discussions:- Create three classes program in cpp

Decode, Problem Description Smugglers are becoming very smart day by day. N...

Problem Description Smugglers are becoming very smart day by day. Now they have developed a new technique of sending their messages from one smuggler to another. In their new techn

Program to print a series, Write a program called Series that will print/di...

Write a program called Series that will print/display a series of numbers starting with 1 and ending with the last number that is less than 30. The series should include only odd n

Assignment, can you tell me what is c#

can you tell me what is c#

Explain the symbolic constants in c language, Explain the Symbolic Constant...

Explain the Symbolic Constants in c language? Symbolic constants are the constants of any type that declared by using the #define compiler directive and it is a preprocessor di

Identifier and constant, What are  Id e n t i f ie rs a n d C o...

What are  Id e n t i f ie rs a n d C o n s t a n ts in C++? Id e n t i f ie r a n d C o n s t a n t : I d e n t i f ie r

C program to swap the two values, Program is to swap the two values which a...

Program is to swap the two values which are enter by user: Program is to swap the two values which are enter by user through the function with values changed using pointers

PEBBLE MERCHANT, There is a pebble merchant. He sells the pebbles, that are...

There is a pebble merchant. He sells the pebbles, that are used for shining the floor. His main duty is to take the length of the room’s sides. But he sometimes mistakes doing that

Define the modulo division operator in c language, Define the Modulo Divisi...

Define the Modulo Division Operator in c language? The C provides one more arithmetic operator % called as modulo division operator and this operator yields the remainder of an

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd