Question

Implement the Message class using a header and implementation file named Message.h and Message.cpp respectively. In...


Implement the Message class using a header and implementation file named Message.h and
Message.cpp respectively. In addition to the two Message class files, you must write a driver. The driver
must create a Message array that is capable of holding 100 messages (make sure that you don’t exceed
the maximum number of Messages). It then must read all Messages from a file named messages.txt
(ordered date\n sender\n recipient\n body\n), sort the Messages based on date, find a Message based on
messageID (value will be given by keyboard input), and print the first five Messages and the Message
resulting from the search. (I suggest that you use one of the sort and one of the search algorithms).

Attributes
string sender – string containing the e-mail address of the sender (e.g. bobbie@school.edu).

string recipient – string containing the e-mail address of the recipient(e.g. bobbie@school.edu).

string body – string containing the message or body of the e-mail.

string date – string containing the date (timestamp) for the message in the form yyyy/mm/dd.

int messageID – integer that stores a unique identifier for each message.

static int messageIDGen – integer used to provide a unique identifier for messageID.

messageIDGen must be initialized outside of the class definition (e.g. Place the

initialization in the implementation file) (HINT:. int Message::messageIDGen = 0).

Member Functions:
Message( )
   Default Constructor that increments the messageIDGen and assigns it’s value to messageID.
Message(string, string, string, string)
  
Constructor with initialization stings for sender, recipient, body, and date. It will also increments
   messageIDGen and assigns it’s value to messageID.
~Message( )
   Destructor
void setSender(string)
   Modifier that allows the user to set the sender string
void setRecipient(string)
   Modifier that allows the user to set the recipient string
void setBody(string)
   Modifier that allows the user to set the body of the message
void setDate(string)
   Modifier that allows the user to set the timestamp of the message
string getSender( )
   Accessor that allows the user to get the sender string
string getRecipient( )
   Accessor that allows the user to get the recipient string
string getBody( )
   Accessor that allows the user to get the body of the message
string getDate( )
   Accessor that allows the user to get the timestamp of the message
int getMessageID( )
   Accessor that allows the user to get the value of messageID
string toString( )
   Function that returns a string representation of a Message object. (You may need to alter the
   code below to match output)

messageID: 12
date: 2006/11/20
sender: bobbie@baylor.edu
recipient: judge_starr@baylor.edu
body: Hope your semester is going well!
#include
string toString()
{
ostringstream result;
result << “messageID: “ << messageID << endl;
result << “date: “ << date << endl;
result << “sender: “ << sender << endl;
result << “recipient: “ << recipient << endl;
result << “body: “ << body << endl;
return result.str();
}

0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 10 more requests to produce the answer.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
Implement the Message class using a header and implementation file named Message.h and Message.cpp respectively. In...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • Provide the definition of class Message, which models an email message, in a file named Message.hpp...

    Provide the definition of class Message, which models an email message, in a file named Message.hpp and implement all the required member functions (see below) in a file named Message.cpp. A message contains a header and a body, which are separated by the first full line break in the message. The message header has a sender, a recipient, a subject representing the message heading, a Unix timestamp representing the sending time of the message, a character encoding, which you can...

  • In Problem Set 7 you designed and implemented a Message class. This time, let's design and...

    In Problem Set 7 you designed and implemented a Message class. This time, let's design and implement a Mailbox class in a file named Mailbox java. Do the following with this class • You may use the Message class from PS 7. You will have to add new features to the Message class from PS 7 as you work through this problem. You are welcome to start with my sample solution if you wish • Suppose there are multiple mail...

  • Using C# Create an application class named LetterDemo that instantiates objects of two classes named Letter...

    Using C# Create an application class named LetterDemo that instantiates objects of two classes named Letter and CertifiedLetter and that demonstrates all their methods. The classes are used by a company to keep track of letters they mail to clients. The Letter class includes auto-implemented properties for the Name of the recipient and the Date mailed (stored as strings). Next, include a ToString() method that overrides the Object class’s ToString() method and returns a string that contains the name of...

  • Using the Die class defined in this chapter, design and implement a class called PairOfDice, composed...

    Using the Die class defined in this chapter, design and implement a class called PairOfDice, composed of two Die objects. Include methods to set and get the individual die values, a method to roll the dice, and a method that returns the current sum of the two die values. Create a driver class called RollingDice2 to instantiate and use a PairOfDice object. I need the main method or test class public class Die { private final int MAX = 6;...

  • This is a simple C++ class using inheritance, I have trouble getting the program to work....

    This is a simple C++ class using inheritance, I have trouble getting the program to work. I would also like to add ENUM function to the class TeachingAssistant(Derived class) which is a subclass of Student(Derived Class) which is also a subclass of CourseMember(Base Class). The TeachingAssistant class uses an enum (a user-defined data type) to keep track of the specific role the TA has: enum ta_role {LAB_ASSISTANT, LECTURE_ASSISTANT, BOTH}; You may assume for initialization purposes that the default role is...

  • its about in C++ You will implement a simple calendar application The implementation should include a class named Calendar, an abstract class named Event and two concrete classes named Task an...

    its about in C++ You will implement a simple calendar application The implementation should include a class named Calendar, an abstract class named Event and two concrete classes named Task and Appointment which inherit from the Event class The Event Class This will be an abstract class. It will have four private integer members called year, month, day and hour which designate the time of the event It should also have an integer member called id which should be a...

  • In this practical task, you need to implement a class called MyTime, which models a time...

    In this practical task, you need to implement a class called MyTime, which models a time instance. The class must contain three private instance variables: hour, with the domain of values between 0 to 23. minute, with the domain of values between 0 to 59. second, with the domain of values between 0 to 59. For the three variables you are required to perform input validation. The class must provide the following public methods to a user: MyTime() Constructor. Initializes...

  • USING C++: Referring to the header file below named coord2d.h, Implement each of the 8 operator...

    USING C++: Referring to the header file below named coord2d.h, Implement each of the 8 operator overloads (operators: <<, [], >, <, two versions of +, two versions of *) #ifndef COORD2D_H #define COORD2D_H #include <iostream> using namespace std; //implement a class that keeps track of the coordinates of a point in the X-Y plane class coord2d { //overload the << operator so that if p is of type "coord2d" then "cout<<p"; //will print out (x_coord, y_coord) //e.g. if p.x_coord=3.4,...

  • I need code in java The Student class: CODE IN JAVA: Student.java file: public class Student...

    I need code in java The Student class: CODE IN JAVA: Student.java file: public class Student {    private String name;    private double gpa;    private int idNumber;    public Student() {        this.name = "";        this.gpa = 0;        this.idNumber = 0;    }    public Student(String name, double gpa, int idNumber) {        this.name = name;        this.gpa = gpa;        this.idNumber = idNumber;    }    public Student(Student s)...

  • MUST BE ANSWERED BY USING C++ Question 1 Unsorted List Implement a template class UnsortedList as...

    MUST BE ANSWERED BY USING C++ Question 1 Unsorted List Implement a template class UnsortedList as defined by the following skeleton: #define MAX_ITEMS 10 typedef char ItemType; class UnsortedList {        private:             int length; ItemType values[MAX_ITEMS]; int currentPos;        public:             SortedList( ); // default constructor: lenght=0, currentPos=-1             void MakeEmpty;    // let length=0             void InsertItem(ItemType x);   // insert x into the list                 void DeleteItem(ItemType x); // delete x from the list bool IsFull( );   // test...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT