Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ Design a class Message that models an e-mail message. A message has a recipi

ID: 3767152 • Letter: C

Question

C++
Design a class Message that models an e-mail message.
A message has a recipient, a sender, and a message text.
Support the following member functions:
-A constructor that takes the sender and recipient and sets the time stamp to the current time.
-A member function append that appends a line of text to the message body
-A member function to_string that makes the message into one long sting like this: “From:Harry Hacker To: Rudolf Reindeer …”
- A member function print that prints the message text. hint: use to_string. Write a program that uses this class to make a message and print it.

Explanation / Answer

package emailmodel;

import java.util.Scanner;
public static void main (String[] args)
{
       public class email
       {
           private String senderemail;
           private String receiveremail;
          
          
           public email(String sender, String receiver)
           {
                   senderemail = sender;
                   receiveremail = receiver;
           }
          
           public void displayemailDeatails()
           {
               System.out.println("To"+ receiveremail +" ");
               System.out.println("From"+ senderemail + " ");
           }
           public class emailExample
           {
               public void main(String[] args)
               {
                   email email = new email(receiveremail, senderemail);
                   email.displayemailDeatails();
               }
           }
          
           public void addsenderemail()
           {
               System.out.print("Please enter sender:");
               Scanner se = new Scanner(System.in);
               senderemail = se.nextLine();
               se.close();  
           }
          
           public void addreceiveremail()
           {
               System.out.print("Please enter receiver:");
               Scanner re = new Scanner(System.in);
               receiveremail = re.nextLine();
               re.close();
           }
          
           public String getsenderemail()
           {
               return senderemail;
           }
          
           public String getreceiveremail()
           {
               return receiveremail;
           }
          
           public class Append
           {
               int emailbody;
               public void main(String args[])
               {
                  
                   System.out.print("Please enter email body:");
                   Scanner in = new Scanner(System.in);
                   emailbody = in.nextInt();
                  
                   String s;
                   StringBuffer sb = new StringBuffer(40);
                   s = sb.append(emailbody).toString();
                   System.out.println(s + " ");
                   in.close();
               }
           }
       }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote