Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This assignment consists of creating a hierarchy of classes for representing bibliographic references, as well as a simple data structure for storing them. The hierarchy

This assignment consists of creating a hierarchy of classes for representing bibliographic references, as well as a simple data structure for storing them. The hierarchy of references has one base class called Reference. All the References have a unique identifier, a title, an author, and a year of publication. The implementation of the classes must follow the object-oriented principles presented in the class.

Q1. Class Reference (15 marks)

Implement a class, called Reference, to represent the characteristics that are common to all the References. Namely,

1. All references must have a unique identifier (of type int).

2. All references have a title and author (both of type string or char*), as well a year of publication (of type int);

3. The class Reference has a default constructor that initializes data members to default values.

4. The class Reference has one regular constructor: Reference(int id, char* author, char* title, int year). Note that you can use string instead of char*. The constructor must initialize the id, author, title and year of publication of this reference using the given parameters.

5. int getId(): returns the unique identifier of this Reference;

6. char* getAuthor(); returns the author of this Reference;

7. char* getTitle(): returns the title of this Reference;

8. int getYear(): returns the year of publication of this Reference;

9. void print(): prints a string representation of this Reference consisting of the id number, reference title, author and year of publication;

Deliverable: reference.h, reference.cpp, and testreference.cpp (you are free to choose how many objects you want to create in order to test the class Reference. This applies also to subsequent questions).

Q6. Class Thesis (20 marks) Thesis is also a specialized Report, that has information about the supervisor and the degree to obtain after completing the thesis. Namely,

1. A Thesis is a specialized kind of Report. Therefore, it must be a derived class of Report;

2. All such documents have a number of pages (type int), a supervisor and degree (both of type string or char*);

3. It has a default constructor that initializes data members, including the data members of the base classes (Report and Reference), to default values.

4. The class Thesis has one regular constructor: Thesis( int id, char* author, char* title, int year, char* institution, char* department, int pages, char* supervisor, char* degree ). It initializes the characteristics common to all Reports, as well as the ones proper to the class Thesis.

5. It implements the member function int getNumberOfPages(), which returns the number of pages of this reference. In the case of Thesis reference, the number of pages is a single number, therefore, the member function simply returns this number;

6. char* getSupervisor(): returns the name of the supervisor;

7. char* getDegree(): returns the name of degree;

8. void print(): returns a string representation of objects of Reports. This member function overrides the one defined in the class Report, which in turn overrides the member function print() of Reference.

Deliverable: thesist.h, thesis.cpp, and testthesis.cpp

class Report

Q4. Class Report (15 marks) Report is a specialized Reference that represents the characteristics that are common to all the Reports. They are two types of reports: Technical Reports and Thesis (see Q5 and Q6). Namely,

1. A Report is a specialized kind of Reference. Therefore, it must be a derived class of Reference.

2. All Reports must have a department and institution (both of type string or char*);

3. It has a default constructor that initializes data members, including the data members of the base class, to default values.

4. The class Report has one regular constructor: Report(int id, char* author, char* title, int year, char* institution, char* department ). It initializes the characteristics common to all References, as well as the institution and department.

5. char* getInstitution(): returns the name of the institution;

6. char* getDepartment(): returns the name of the department;

7. void print(): returns a string representation of objects of Reports. This member function overrides the one defined in the class Reference.

Deliverable: report.h, report.cpp, and testreport.cpp

In c++ please

thank you in advance

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions