Question: can you change the code that I will give you according to instructions? using System; using System.Collections.Generic; using System.Text; namespace LAB 2 { class Mail

can you change the code that I will give you according to instructions?
using System;
using System.Collections.Generic;
using System.Text;
namespace LAB2
{class Mail
{ private DateTime Date;
private String Subject;
private String Body;
public (String, String) Sender { get; private set; }
public (String, String) Receiver { get; private set; }
public DateTime GetDate(){ return Date; }
public String GetSubject(){ return Subject; }
public String GetBody(){ return Body; }
public Mail(DateTime date, (String, String) sender,(String, String) receiver, String subject, String body)
{Date = date; Sender = sender; Receiver = receiver; Subject = subject; Body = body;
} public override String ToString()
{String finalString = Date.ToShortDateString()+","+ Date.ToShortTimeString()+"
";
finalString += "From: "+ Sender.Item1+""+ Sender.Item2+">
";
finalString +="To: "+ Receiver.Item1+""+ Receiver.Item2+">
";
finalString += "Subject: "+ Subject +"
"+ Body;
return finalString;
} public virtual void DisplayHeader(){ Console.WriteLine("Subject: "+ Subject); }}}
using System;
using System.Collections.Generic;
using System.Text;
namespace LAB2
{ class Mailbox
{ public List Mails { get; set; }
public int Capacity { get; set; }
public Mailbox()
{ Mails = new List();
Capacity =5; // To test capacity
} public virtual void DisplayMailbox()
{ if (Mails.Count ==0)
Console.WriteLine("No mails here!"); else {
for(int i =0; i Mails.Count; i++){
Console.Write((i+1)+")");
Mails[i].DisplayHeader();}}}
public Mail ReadMail(int selection)
{ Console.WriteLine(Mails[selection].ToString());
return Mails[selection]; }
public virtual void DeleteMail(int selection)
{Mails.RemoveAt(selection);}}}
using System;
using System.Collections.Generic;
using System.Text;
namespace LAB2
{
class User
{
private String Name { get; set; }
private String EmailAddress { get; set; }
private Mailbox Inbox { get; set; }
private Mailbox Outbox { get; set; }
private Trash Trash { get; set; }
public User(String name, String emailAddress)
{
Name = name; EmailAddress = emailAddress;
Inbox = new Mailbox(); Outbox = new Mailbox(); Trash = new Trash();
}
public void ReadMailbox(String mailbox)
{
Mailbox selectedMailbox = SelectMailbox(mailbox);
if (selectedMailbox is null)
{
Console.WriteLine("Incorrect input.");
return;
}
Console.WriteLine((mailbox == "I" ? "Inbox " : (mailbox =="O"? "Outbox " : "Trash "))+ "for "+ Name +""+ EmailAddress +">:");
selectedMailbox.DisplayMailbox();
if (selectedMailbox.Mails.Count >0)
{
Console.Write("
Enter the number for the mail you want to read: ");
int mailSelection = Convert.ToInt32(Console.ReadLine());
Console.Clear();
Mail selectedMail = selectedMailbox.ReadMail(mailSelection -1);
Console.WriteLine("
1) Forward
2) Reply
3) Delete" +(mailbox =="T"?"
4) Restore" : ""));
Console.Write("
Choose an action (-1 to exit): ");
int selection = Convert.ToInt32(Console.ReadLine());
if (selection ==-1)
return;
else if (selection ==1)
ForwardMail(selectedMail);
else if (selection ==2)
ReplyToMail(selectedMail);
else if (selection ==3)
{
if (mailbox !="T")
Trash.AddMail(selectedMail,(mailbox == "I" ? InOutEnum.Inbox : InOutEnum.Outbox));
selectedMailbox.DeleteMail(mailSelection -1);
Console.WriteLine("Mail successfull
also I need Trash.cs, AutomatedMail.cs and Program.cs
can you change the code that I will give you

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!