For this project, you will implement an email client-server simulator using the object-oriented design diagramed below. · The following class diagram shows class attributes (members) and methods...

1 answer below »
c++: please screen shot of the result as well


For this project, you will implement an email client-server simulator using the object-oriented design diagramed below. · The following class diagram shows class attributes (members) and methods (operations). Operations are denoted with a plus.  The diamonds indicate an aggregation relationship. · All class attributes are private unless denoted otherwise and therefore must be accessed with get/set methods. Private attributes assume get methods accessors and are therefore not shown in the UML diagram as operations. The developer must add these.  · Messages are simultaneously sent and received. Therefore, a Message is stored in the inbox of the recipient and the sent box of the sender when sent. · A Mailbox object contains both inbox messages and sent messages and the operations are outlined below. Mailboxes are linked to a user. A Mailbox  contains two lists of type vector, one for the inbox, one for the sent box. · Finally, a MailboxList contains any number of user Mailboxes. The following UML diagram expected a Java implementation but you will of course implement your classes in C++.  Use vector in place of ArrayList.    Message Class Method (Option) Function void append(String line) Append a line to the messageText string getMessageTextHeader() Formats a string contained a summary of the message suitable for display in the inbox or sent message box. toString() Creates a formatted string containing the To, From. Subject, Date, and Message Text of a Message. print() Sends the toString() results to the display send(sender, recipient, subject)  Creates a Message including sender, recipient, subject, and date.   MessageText is added with append method.   Mailbox Class Method (Option) Function vector getSentMessages() Returns a list of message summaries for sent message box. vector getMessages() Returns a list of message summaries for inbox messages. void addSentMessage(Message) Adds a sentMessage to sentMessages ArrayList void addMessage(Message) Adds an inbox Message to messages ArrayList Message getMessage(int i)   Retrieves the ith inbox message Message getSentMessage(int i)   Retrieves the ith  sent message void removeSentMessage(int i) Remove ith sent message void removeMessage(int i) Remove ith inbox message   Mailbox List Class Method (Option) Function Mailbox getUserMailbox Returns Mailbox by user   Notes:  · You are provided with a template solution for this project. You will need to implement several of the methods to make the program functional.   Download the zipfile and extract it to your default CLionProejcts directory, then open with CLion.  My default CLionProjects directory is at:  c:\users\CLionProjects where is my username.  · Start CLion and open the project MailboxListStub you have extracted.  You can compile and run the project as is, but it will not give any reasonable output until you make the required modifications. · Several of the more complex methods are left implemented for you. GetMessageHeader for example illustrates date formatting in C++.   The message summary prepared by this method includes the sender, subject, date, and the first line of the messageText.  The split method returns the messageText up to the first newline.  Study the details of this method to understand how this is done.  · The MailboxList class is designed to be a singleton, that is there is only one instance of this class. The method GetUserMailbox(String user)  will search for a Mailbox by user.  If the user does not exist it will create a new Mailbox for the new user and add it to the MailboxList.  · The emailServer class is a sample test driver to test your implementation.  Please change your messages and users to make the program your own. Submission Instructions:  · Submit your completed C++ file(s) and a screenshot of your test output including various test cases.
Answered Same DayDec 08, 2021

Answer To: For this project, you will implement an email client-server simulator using the object-oriented...

Aditya answered on Dec 11 2021
162 Votes
New folder/email.cpp
#include
#include
#include
#include
#include
#include
#define Size 50

using namespace std;
class Message;
/**************************/
class Mailbox {
private:
string user;
vector inboundMessages;
vector sentMessages;
public:
Mailbox(string usr) {
user= usr;
}
const string getUser() {
return user;
}
vector getInboundMessages() {
return inboundMessages;
}
vector getSentMessages() {
return sentMessages;
}
void send(Message *message) {
sentMessages.push_back(*message);
}
void receive(Message *message)
{
inboundMessages.push_back(*message);
}
};
class Message {
private:
string recipientName;
string senderName;
string subject;
string messageText = "";
time_t date = time(0); // time now
struct tm *tmp = localtime( &date ); // put time into tm struct (time struct)
public:
Message(string rec, string sendr, string sub)
{
recipientName = rec;
senderName = sendr;
subject = sub;
messageText = "";
}
void append(const string &line) {
if (messageText.length() > 0 )
messageText = messageText + "\n" + line;
else
messageText = line;
}
string toString()
{
return "From: " + senderName + "\nTo: " + recipientName + "\nSubject: " + subject + ...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here