Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The textbook / lecture defines class Iterator that is then used together with class NodeList, which is the container. Software Engineering suggests the separation of

The textbook/lecture defines class Iterator that is then used together with class NodeList, which is the container.
Software Engineering suggests the separation of the data structuring class (container) from the methods used in traversing the data (iterator). This allows to change the data traversing and accessing methods without affecting the container class. This is because iterators access the container data without exposing its structure.
Operator overloading allows to extend the meaning of the C++ operators to the user defined types, e.g., classes. In this example, the overloaded operators == and != check if two list nodes in class NodeList are equal or different depending on how the programmer defines the meaning of the two operators. The overloaded operators ++ and -- offer the access of the next and previous list nodes. Finally, the overloaded operator * allows to access the node content like a referencing operator (an extension of *p where p is a pointer to a variable in C language).
Note that the overloaded operators == and != are binary operators, while ++,--, and * are unary operators.
1.Finish the definition of class NodeList and create a main() program that uses all the class methods and show that the use of the operators is correct.
2.
Change class NodeList so that each node stores a string instead of an integer
value. An object of class NodeList stores an entire sentence, such as the first node stores the first word of the sentence, the second node stores the second
work of the sentence, and so on.
Implement a simple text editor in which every row is a separate object of class NodeList.
Create a class Iterator that has the following methods:
Submit the main program with comprehensive tests. Complete Task 2 with up() and down() as a homework assignment. Submit to Lab 7.
Method Left () to move the current cursor to the word to the left of the
current position of the cursor.
Method Right () to move the current cursor to the word to the right of
the current position of the cursor.
Method Up () to move to the beginning of the row above the current
row. - homework
Method Down () to move to the beginning of the row below the
current row. - homework
The text editor has the following methods:
*Display_editor () displays the current content of the text editor, such as all sentences, one below the other.
*Add_word () adds a new word read from the keyboard in front of the word currently pointed at by the cursor.
*Remove_word () removes the word currently pointed at by the cursor. Use the defined classes to implement the simple text editor program.

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

Recommended Textbook for

Learning MySQL Get A Handle On Your Data

Authors: Seyed M M Tahaghoghi

1st Edition

0596529465, 9780596529468

More Books

Students also viewed these Databases questions

Question

Which is the worst idea? Why?

Answered: 1 week ago

Question

What is (are) the invoice number(s) of the duplicate payments?

Answered: 1 week ago