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

Explain the working of array with strings, Explain the working of Array wit...

Explain the working of Array with Strings? A string is defined in C language as an array of characters. A null character (‘\0') is automatically added to the end of the charact

Class booking system, I want source code for class booking system by using ...

I want source code for class booking system by using C++ Programming...Urgent

Hw8, Asks the user for an integer. if the number is less than 21, ask them ...

Asks the user for an integer. if the number is less than 21, ask them for a number again; repeat this until you get a number bigger than 20. 20 is not an acceptable number. Once yo

Determine the current flowing in the circuit - voltage, Four cells, each wi...

Four cells, each with an internal resistance of 0.40 ? and an e.m.f. of 2.5 V are connected in series to a load of 38.40 ?. (a) Verify the current flowing in the circuit and t

Explain type casting, Type Casting Implicit type conversions, as allowe...

Type Casting Implicit type conversions, as allowed by the language, can lead to errors creeping in the program if care is not taken. Thus, explicit type conversions may be used

C++, Byteland county is very famous for luminous jewels. Luminous jewels ar...

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

Array, Write a program to count the prime number in array

Write a program to count the prime number in array

Hep, I need help with a c# program. Do yall help with c sharp

I need help with a c# program. Do yall help with c sharp

Bubble sort, sample of program that use in bubble sort using assignment ope...

sample of program that use in bubble sort using assignment operator in c++

How many ways are there to initialize an int with a constant, There are two...

There are two ways for initializes in C++ as shown in the example that follows. The first way uses the traditional C notation. The second way uses constructor notation. int foo

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