The IT department of TEDU decided to build its own simple version of an email server....
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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 <i> 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 <i> S <Folder>Show the contents of the folder in descending order of arrival times. parameter <Folder> 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 <Folder> Show all unread emails in the folder in descending order of arrival times. The parameter <Folders can be one of: Inbox, Archive, Trash. C <Folders Clear the contents of the folder. The parameter <Folders can be one of Inbox, Archive, Trash. If the parameter is Trash, the program should empty it. If the parameter is Inbox or Archive, then the program should move all emails from the target folder to the Trash. d) EmailTester Class You must also provide a tester class for Part I that demonstrates the functionality of your implementation. Be sure to include all the extreme cases. PART II The second part of the homework is about stacks. Note: Also for this section, you must use your own implementation of stacks. The stack should use generics, and use a linked-list based implementation (Note: you must also provide a tester class for Part II that demonstrates the functionality of your implementation. Be sure to include all the extreme cases.) a) Calculator (Cale) Class You task is to implement a basic calculator that supports integer operands like 1, 647, and -42 as well as the (binary) integer operators +,,, and %. The style of arithmetic expressions our calculator will evaluate is also called a post-fix notation. Stacks are great for doing this job! Your task is to write a driver (client) program that uses the generic Stack interface we discussed in class, and one of the given implementations to perform these calculations as specified here. Your program should be called Cale and work as follows: • The user enters input that consisting of operands and operators, presumably in post- fix notation. • If the user enters a valid integer, you push that integer onto the stack . 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. 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 <i> 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 <i> S <Folder>Show the contents of the folder in descending order of arrival times. parameter <Folder> 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 <Folder> Show all unread emails in the folder in descending order of arrival times. The parameter <Folders can be one of: Inbox, Archive, Trash. C <Folders Clear the contents of the folder. The parameter <Folders can be one of Inbox, Archive, Trash. If the parameter is Trash, the program should empty it. If the parameter is Inbox or Archive, then the program should move all emails from the target folder to the Trash. d) EmailTester Class You must also provide a tester class for Part I that demonstrates the functionality of your implementation. Be sure to include all the extreme cases. PART II The second part of the homework is about stacks. Note: Also for this section, you must use your own implementation of stacks. The stack should use generics, and use a linked-list based implementation (Note: you must also provide a tester class for Part II that demonstrates the functionality of your implementation. Be sure to include all the extreme cases.) a) Calculator (Cale) Class You task is to implement a basic calculator that supports integer operands like 1, 647, and -42 as well as the (binary) integer operators +,,, and %. The style of arithmetic expressions our calculator will evaluate is also called a post-fix notation. Stacks are great for doing this job! Your task is to write a driver (client) program that uses the generic Stack interface we discussed in class, and one of the given implementations to perform these calculations as specified here. Your program should be called Cale and work as follows: • The user enters input that consisting of operands and operators, presumably in post- fix notation. • If the user enters a valid integer, you push that integer onto the stack . 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.
Expert Answer:
Answer rating: 100% (QA)
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... View the full answer
Related Book For
Statistical Techniques in Business and Economics
ISBN: 978-1259666360
17th edition
Authors: Douglas A. Lind, William G Marchal
Posted Date:
Students also viewed these accounting questions
-
You are a senior analyst in the IT department of a company manufacturing automobile parts. The marketing VP is complaining about the poor response by IT in providing strategic information. Draft a...
-
a) The IT department of a department store uses tape to archive data. Explain major points you could provide to persuade the IT department to move to a CAS solution. How would your suggestions impact...
-
You have decided to divide a factory into cost centers. How would you allocate depreciation expense on the factory building to its individual cost centers?
-
What is the payback period? Name and discuss three possible reasons that the payback period is used to help make capital investment decisions.
-
You have decided to open a company that produces wooden furniture, and you must select a suitable location for production. The first option is in a remote region of Montana with easy access to...
-
The picture shown depicts the species present at the start of a combustion reaction between methane, CH 4 , and oxygen, O 2 . (a) Draw the resulting state after this set of reactants has reacted as...
-
The typical shape of small cumulus clouds is as indicated in Fig. P9.17. Based on boundary layer ideas, explain why it is clear that the wind is blowing from right to left as indicated. Figure P9.17 U
-
Voss Company acquired patent rights on January 6, 2011, for $480,000. The patent has a useful life equal to its legal life of eight years. On January 3, 2014, Voss successfully defended the patent in...
-
A life-changing event occurred when I found myself single in a massive house with empty spaces. The home was full of memories and due to unavoidable circumstances, moving was not an option. In an...
-
Danny Imasuen is a 37-year-old student working in Quebec. His wages for the current weekly pay period are $580.00. The employer pays $22.00 for life insurance premiums and $190.00 for group medical...
-
1) Define anatomical position and why we use it in the funeral profession. 2) Unrelated to Anatomy: what are some things that you do to relax or "reset" your brain? Are there any exercises or...
-
Suppose over the next period a stock will either go up by a factor u = 1.26, or down by a factor d = 0.76. How many shares of the stock are in the replicating portfolio for the one-period...
-
A currency dealer is considering trading between Australian dollar (AUD) and Norwegian Krone (NOK). A put option allows the holder to sell NOK400 000 now at an exercise exchange rate of 0.2540...
-
Suppose it's Oct 31 you wanted to find out the total amount of wage expense a company has incurred for all 2,000 employees from Jan 1 through October 31. What accounting record would you reference to...
-
How do businesses account for at least two long-term liabilities?
-
It takes 27.5 hours for a 25-gram sample of element X to decay to a final amount of 5 grams. What is the half-life of element X in days? = 27.5 hours A 0 = 25 g A F = 5 g t =?? Nitrogen gas is being...
-
The maintenance on a machine is expected to be $155 at the end of the first year, then increasing by $35 each year for the next 7 years. Instead of finding the sum of money would need to be set aside...
-
Citing a scientific article, explain in your own words, how DNA fingerprinting has been used in forensic science to solve crimes and why it may not always be accurate or effective.
-
Long Last Tire Company, as part of its inspection process, tests its tires for tread wear under simulated road conditions. Twenty samples of three tires each were selected from different shifts over...
-
Fred decided to study the number of exemptions claimed on personal tax returns he prepared in 2017. The data are summarized in the following table. Exemptions ............................Percent...
-
The state of Maryland has license plates with three numbers followed by three letters. How many different license plates are possible?
-
To cool water for drinking during summer, \(1 \mathrm{~kg}\) of ice at \(-2^{\circ} \mathrm{C}\) is mixed with \(5 \mathrm{~kg}\) of water at \(27^{\circ} \mathrm{C}\) in an insulated container...
-
In a cyclic process, heat transfers are \(+14.7 \mathrm{~kJ},-25.2 \mathrm{~kJ},-3.56 \mathrm{~kJ}\) and \(+31.5 \mathrm{~kJ}\). What is the net work for this cyclic process?
-
A heat pump operates between two identical bodies of specific heat \(C\) at \(T_{1}\). The operation of the pump cools down one of the bodies to \(T_{2}\). Show that for the operation of pump the...
Study smarter with the SolutionInn App