Answered step by step
Verified Expert Solution
Question
1 Approved Answer
c++ Object Oriented programming Homework 2 Deadline 3-1-2021 (Firm, no extensions) . Q1: Implement the following classes: Line class, where each line has (22 marks)
c++
Object Oriented programming Homework 2 Deadline 3-1-2021 (Firm, no extensions) . Q1: Implement the following classes: Line class, where each line has (22 marks) attribute content (as private string). (2 marks) Default and initializer constructors (4 marks) o O O destructor, (2 marks) O O setters and getters (4 marks) Define print function that prints line contents. (2 marks) Void concat(line &/2), which concatenates the two lines contents and empty the received one. (4 marks) HasSameContentLine &12) which compares two objects and returns back true if they both O . o O o O have the same exact content. (4 marks) Page class where each page has (23 marks) two private members: 1) array of 30 lines and 2) page number. (2 marks) The constructor should initialize the lines to empty string and page number to 0. (2 marks) Destructor (2 marks) Setters (lines and page number) and one getter for page number (6 marks) AddLine member function that receives a line object and adds it to current page. The line will be added after last non-empty line. If number of lines is already 30, it will display a message "cannot add line, page is full". (4 marks) print function that prints page lines line by line. (3 marks) HasMorelines(Page &p2) which compares the two pages and return back true if original object has more Lines than object p2. (4 marks) Book class, where each book has (30 marks) private attributes: 1)a dynamic array of pages, 2) the current number of pages. (2 marks) Constructor (2 marks) and copy constructor (4 marks) Destructor (2 marks) Getter for number of pages(2 marks) O o O o O O o AddPage member function. It receives a page object and adds it to the book. Each time a page is added, it is assigned a page number based on sequence of addition. (6 marks) Print function to print the book pages page by page, the function should print a separator line between every two pages. (4 marks) HasMorePages(Book &B2) which compares the two book objects and return back true if original object has more pages than object B2. (4 marks) HasMorelines(Book &B2) which compares the two book objects and return back true if original object has more Lines than object B2. (4 marks) O O You have to separate header from implementation for all classes
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started