Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The IT department of TEDU decided to build its own simple version of an email server. They divide the emails into 3 categories, namely:

 

The LinkedListofnails class should support the following methods .addEmail Email Adds a new email to the list. Note that allder Show the contents of the folder in de parameter Folders can be one of Tax Archive, Trash. You should print the truncated• If the creates a valid operator, yo popi es of the stack perform the requested operation and push the result back on the st  

The IT department of TEDU decided to build its own simple version of an email server. They divide the emails into 3 categories, namely: INBOX, ARCHIVE and TRASH. You are asked to implement a system that manages emails. a) Email Class First, you must implement an Email Class. The email will be implemented within the Email class, which holds: subject String ID: Integer . message: String time: Integer //milliseconds flag boolean The methods should include a default constructor, and the set...(), get...() methods for each of the attributes. b) LinkedListOfEmails Class First, implement a Singly-linked LinkedListOfEmails class (together with a private class Node). Each node should store an Email object as its data. Consider that the emails in the lists are sorted in a descending order on the arrival time (i.e. newest first, oldest last). As mentioned above, the emails are divided into three categories, namely: INBOX, ARCHIVE and TRASH. Therefore, in your program (in Part C), you should create three linked lists, with these names: Inbox, Archive, Trash. The LinkedListOfEmails class should support the following methods: .addEmail( Email E): Adds a new email to the list. Note that emails in all the lists are sorted in descending order on the arrival time (i.e. newest first, oldest last). read int id: Show current Email details with the given email id, and set true current Email read-Flag and change current index to next. Email delete(int id): Delete the Email with the given email id, and return the corresponding Email object. void showAll boolean flag): Print all emails details in all categories. If flag is true, all emails are shown. If flag is false, only unread emails are shown. c) Email Application Class First, as mentioned above, the emails are divided into three categories, namely: INBOX, ARCHIVE and TRASH. Therefore, in your program, you should first create three empty linked lists, with these names: Inbox, Archive, Trash. Then, your program should read input from the standard input line-by-line. Each line of input will contain: N New email arrived. For example: > N //Hello from CMPE242.//1234//This is a welcome anail from the course.//2364675// > N //Homework 1 posted. //1237//This is your first homework for the course.//2254672// R Read an email with the given id. For example: > R 1234 Email id: 1234 Subject: Helle from CP242 Body: This is a welcone email from the course. Time received: 2364675. Status: Read > R 1235 No such mail. Archive the email with the given id. This should move the email from the Inbox to the Archive. Note that the two lists are sorted in descending order. For example: >A 1214 Email 1234 archived Delete the email. This should move the email from the Inbox to the Trash. Note that the trash is also sorted in descending order. A cids D S Show the contents of the folder in descending order of arrival times. parameter can be one of: Inbox, Archive, Trash. Time Read mail Subject Body 1234 Hello from CMP242. This is a welcome mail. 2364675 Rework 1 posted. This is your first ho... 2254675 No Yes You should print the truncated form of the subject and body strings to 25 and 40 characters, respectively. Check the Java System.out.printf() method details U Show all unread emails in the folder in descending order of arrival times. The parameter . If the user enters a valid operator, you pop two imtegers off the stack, perform the requested operation, and push the result back onto the stack. If the user enters the S as an input, you print the current state of the stack. If the user enters the P as an input, you pop the top element off the stack and print only that element (not the entire stack) followed by a new line. If the user enters the E. you exit the program Note that there are a number of error conditions that your program must deal with gracefully for full credit. This means that you'll have to print error messages to the user. Examples 1 Sava Cale E 3 [10] 20:30 [30, 20, 10] s [600, 101 S [610) 612 (1 b) Cale Tester Class You must also provide a tester class that demonstrates the functionality of your implementation. Be sure to include all the extreme cases. e) Any other necessary classes (Stack etc.) Be sure to include any other necessary classes to implement Part II.

Step by Step Solution

3.48 Rating (151 Votes )

There are 3 Steps involved in it

Step: 1

JAVA CODE import javautil Email class class Email String subject int ID String message int time1 boolean flag EmailConstructor subjectnull ID0 messagenull time10 flagfalse taking input void set Scanne... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Statistical Techniques in Business and Economics

Authors: Douglas A. Lind, William G Marchal

17th edition

1259666360, 978-1259666360

More Books

Students also viewed these Accounting questions