In: Computer Science
Draw UML diagram
Define a class named Document that contains a member variable of
type string named text that stores any textual content for the
document. Create a function named getText that returns the text
field and a way to set this value.
Next, define a class for Email that is derived from Document and
that includes member variables for the sender , recipient , and
title of an e-mail message. Implement appropriate accessor and
mutator functions. The body of the e-mail message should be stored
in the inherited variable text .
Similarly, define a class for File that is derived from Document
and that includes a member variable for the pathname. Implement
appropriate accessor and mutator functions for the pathname.
Each class should have a display function to display the complete
contents.
Create a class Author with name and id. Author is responsible to
create the document. It means every document should have an
author.
Create a class Administrator with name and id. Administrator can
delete the document if he finds these words (“corrupt, liar,
dishonest”) in the document text.
Finally, create several sample objects of type Email and File in
your main function. Test your objects by creating a test program.
Also create relationships with author and administrator with
document.
Please find below the steps to construct the class diagram:
1. Creating classes:
The system will have below classes:
i. Document: This class has below members and methods:
ii. Email : This class will have below methods and members:
iii. File: This class will have below members and methods:
iv. Author: This class will have below methods and members:
v. Administrator: This class will have below methods and members:
2. Identifying relationship:
a) Document class is super class to below classes:
i. File Class
ii. Email Class
b) Document is written by one Author and an author can have written many Documents. It is a M:1 multiplicity relationship.
c) Document is deleted by none or one Administrator and an administrator can delete none or many Documents, this is a M:1 relationship.
3. Create Diagram:
4. Notations in Class diagram: