Microsoft Word - COEN244_A2 _Winter2021.docx COEN 244 – Winter 2021 1/3 Assignment 2 : Inheritance Deadline: Monday February 15 at 23:59 Type: Individual Assignment Weight: 5% Marking Scheme: ‐...

1 answer below »
Please I need this assignment in C++ and by union only preliminary c++ knowledge


Microsoft Word - COEN244_A2 _Winter2021.docx COEN 244 – Winter 2021  1/3  Assignment 2 : Inheritance   Deadline:  Monday February 15 at 23:59   Type:   Individual Assignment   Weight:   5%   Marking Scheme:  ‐ Program correctness (70%)  ‐ Program clarity (output format, comments, completeness, readability) (10%)  ‐ Test cases to be comprehensive enough to cover your program to test if it is bug free (20%)  Q1. Class Reference (10 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 as year of publication (of type int); Q2. Class Article (10 marks)  Article is a specialized Reference that also has information about the journal where the article is  published, start page, and end page. More precisely,  1. An Article is a derived class of Reference 2. It  also  stores  information  about  the  journal  (type  string or  char*),  and  the  startPage  and endPage (both of type int); 3. It  implements  the additional member  function  int getNumberOfPages(), which  returns  the total number of pages (computed using starPage and endPage); Q3. Class Book (10 marks)  Book is also a specialized Reference that has information about the publisher of this reference.  It also has number of pages as one of its attributes.  1. Book is a derived class of Reference 2. It stores the publisher (type string or char*) of this reference and the number of pages of this book (type int); COEN 244 – Winter 2021    2/3  3. It also implements the member functions getNumberOfPages(), which returns the number of  pages of this reference. In the case of Book reference, the number of pages is a single number,  therefore, the member function simply returns this number;  4. It also implements functions related to the publisher.  Q4. Class TextBook (10 marks)    TextBook  is  a  specialized  Book.  A  textbook  has  an  additional  attribute, Web  URL  (Uniform  Resource Locator), where students can find additional material such as slides, exercises, etc.    1. TextBook is a derived class of Book  2. It implements additional functions related to the setting and getting the URL    Q5. ReferenceManager (30 marks)    Create a class called ReferenceManager that will be used as a container to hold objects  of classes Article, Book, and TextBook.    1. ReferenceManager has a fixed capacity. It uses a fixed size array to store References.  2. The first reference added to the container will be added at position zero, the second one at  position 1, and so on. A reference is always added at the next available position;  3.  A  ReferenceManager  has  one  regular  constructor:  ReferenceManager(int  capacity).  The  constructor must create an array of size capacity, which will be used to store References. It will  also initialize the instance variables that your implementation requires.  4. ReferenceManager will have size data member, which will track the number of references in  the array.  5. bool add(Reference & reference): adds a reference at the next available position and returns  true, or returns false if the reference manager is full.  6.  int get(int pos): returns the  identifier of the Reference object stored at position pos of the  ReferenceManager. You can assume that pos is a valid index, i.e. 0 <>< size;  7.  bool  delete(int  pos):  removes  the  element  at  position pos  of  this referencemanager  and  returns true, or returns false if pos was not a valid index. it must also shift the elements of the  array towards the beginning of the array;  8. bool search(int id); return true if the reference with identifier id exists, false otherwise  coen 244 – winter 2021    3/3  key notes:  all the classes should have   at least a default constructor, a copy constructor and a destructor  accessing functions  a print function 7. ="" bool ="" delete(int ="" pos): ="" removes ="" the ="" element ="" at ="" position pos ="" of ="" this referencemanager ="" and ="" returns true, or returns false if pos was not a valid index. it must also shift the elements of the ="" array towards the beginning of the array; ="" 8. bool search(int id); return true if the reference with identifier id exists, false otherwise ="" coen 244 – winter 2021 =""  ="" 3/3 ="" key notes: ="" all the classes should have ="" ="" at="" least="" a="" default="" constructor,="" a="" copy="" constructor="" and="" a="" destructor="" ="" accessing="" functions="" ="" a="" print="">
Answered 9 days AfterFeb 13, 2021

Answer To: Microsoft Word - COEN244_A2 _Winter2021.docx COEN 244 – Winter 2021 1/3 Assignment 2 : Inheritance...

Shweta answered on Feb 22 2021
139 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here