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

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.

Posted Date: 3/15/2013 1:09:53 AM | Location : United States







Related Discussions:- Create three classes program in cpp, Assignment Help, Ask Question on Create three classes program in cpp, Get Answer, Expert's Help, Create three classes program in cpp Discussions

Write discussion on Create three classes program in cpp
Your posts are moderated
Related Questions
though the ascii is called 7-bit code. why do we use 8-bits to represent a character?

Molecular dynamics for a Lennard-Jones system (in C++) 1. Write a function which reads in the input variables of a molecular dynamics simulation of a Lennard-Jones system. The inpu

Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particular colour. Nec

Stage One Define the specification of the program            Add two nxm size matrices   Stage Two Divide the program up into separate modules           Input Matrix         Ad

Need Squid Web Proxy with ffmpeg to convert flv to h.264 Project Description: We need a squid proxy setup with the modification that will transcode FLV to h.264 in real-time,

What if I wish a local to "die" before the close} of the scope wherein it was created? Can I call a destructor on a local if I want to?

Write a function that calculates the number of elapsed days between two dates. For example the days between Feb 3, 1970 and June 21, 1980? Becareful for the Leap year

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

given number is prime or not

What is the use of default constructor? - It's a constructor that doesn't accept any parameters. - If there is no user-defined constructor for a class, compiler declares a d