Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

bartleby

Concept explainers

Question

In Java

MailBox
- client:String
- emails: Email[]
- actualSize: int
+ Mailbox()
+ Mailbox(client:String)
+ getClient(): String
+ getEmail(int index): Email
+ getActualSize(): int
+ addEmail(email: Email): void
+ sortEmailsByDate(): void
+ findEmail(year:int: Email
+ countUrgent():int
+ toString(): String

Write java code for all the methods shown on the class diagram. Below are
the details needed for the different methods:
a. The default constructor will assign the client a default name (any value of
your choice). Keep in mind that a single mailbox (e.g., gmail) can handle a
maximum of 15 emails, but it can hold less, which is the actual size of the
emails array. So, the constructor should instantiate the emails array
instance variable by creating an array of size 15. It should also set the
actualSize variable to 0.
b. The MailBox (String client) constructor should call the default constructor
using chaining. It should then initialize the client variable using the client
parameter.
c. The toString method will format the mailbox information, including the
client (e.g., gmail), a count of the urgent emails by calling the countUrgent
method, and a list of emails in the the emails array (see sample output).
Each element in the emails array represents an email object, so the
toString() method of the Mailbox should call the toString method of the
Email class (see Email class below).
d. The findEmail method that takes the year as a search key and returns the
email in the emails array that meets the criteria. For example,
findEmail(2022) returns the email that was received in 2022.
e. The addEmail method takes an Email object and adds it to the emails
array at the next available location keeping the maximum size into
account. If the max size is reached it should display "You have reached
maximum capacity. Upgrade your account".
f. countUrgent method should return how many emails in the emails array
are urgent.

Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
    SEE MORE QUESTIONS
    Recommended textbooks for you
    Text book image
    Database System Concepts
    Computer Science
    ISBN:9780078022159
    Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
    Publisher:McGraw-Hill Education
    Text book image
    Starting Out with Python (4th Edition)
    Computer Science
    ISBN:9780134444321
    Author:Tony Gaddis
    Publisher:PEARSON
    Text book image
    Digital Fundamentals (11th Edition)
    Computer Science
    ISBN:9780132737968
    Author:Thomas L. Floyd
    Publisher:PEARSON
    Text book image
    C How to Program (8th Edition)
    Computer Science
    ISBN:9780133976892
    Author:Paul J. Deitel, Harvey Deitel
    Publisher:PEARSON
    Text book image
    Database Systems: Design, Implementation, & Manag...
    Computer Science
    ISBN:9781337627900
    Author:Carlos Coronel, Steven Morris
    Publisher:Cengage Learning
    Text book image
    Programmable Logic Controllers
    Computer Science
    ISBN:9780073373843
    Author:Frank D. Petruzella
    Publisher:McGraw-Hill Education