Question: File concatenation: Many operating systems allow one to concatenate files. a) Design a class called MyDocument that reads the contents of a text file only.
File concatenation: Many operating systems allow one to concatenate files.
a) Design a class called MyDocument that reads the contents of a text file only.
b) Create a constructor that takes the path of a text file.
c) Create the following methods __str__ and __repr__ to be used to print out the contents of the text file to the screen
d) Create an overloaded addition operator for this class that adds (concatenates) two MyDocument objects (appends the second one at the end of the first one) and creates a new text file.
e) Handle all possible error cases, such as for file existence.
f) Include sample code and text files that uses your class and demonstrates the use of all methods as well as demonstrating error handling.
g) at the end of your code show an illustrated run of your code """ """
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
