2. Read all eight messages into Mailbox object from the file of "messages1.txt". The values for each line will be used to initialize each instance variable of the Message object, and then added into the Mailbox object. Important: Your must read the values in from the file using Scanner object, you are not allowed to initialize the objects manually. 3. Print out all messages using printAllMessages () method. Your output should look like Figure 2. Bluel: Terminal Window - 1 Solution Options Message list in the mailbox after loading from a file Message 1 From: Eric_A_Bially To: Zachary_B_Howard This is_test_message_1 Message 2 From: Brett_V_Bohorquez To: Marcus_R_McPartland This is_test_message_2 Message 3 From: Aron_I_Brewster To: Patrick_C_Nauman This is_test_message_3 Message 4 From: Joshua_J_Dennis To: Jacob_G_Neff This_is_test_message_4 Message 5 From: Stephen_M_Gentzler To: Kevin_A_0rlowski This is_test_message_5 Message 6 From: Adam_James_D_Geosits To: Oscar_J_Phillips This is_test_message_6 Message 7 From: Rudolf_C_Gouker To: Andy_R_Sayer This_is_test_message_7 Message 8 From: Zachary_B_Howard To: Craig_Smith This is_test_message_8 Figure 2: A screenshot of the program output 2. 4. Remove message at position 0 (index) using removeMessage (), and repeat it six times.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
5. Print out all messages in the mailbox object using printAllMessages () method. Your
output should look like Figure 3.
4 Bluel: Terminal Window - 1_Solution
Options
Message list in the mailbox after removing six messages
Message 1
From: Rudolf_C_Gouker
To: Andy_R_Sayer
This is test_message_7
Message 2
From: Zachary_B_Howard
To: Craig Smith
This is test_message_8
Can only enter input while your programming is running
Figure 3: A screenshot of the program output 3.
2
Required outputs
You should print out all three outputs as shown in Figures 1-3. Put them together (copy
and paste) in one output file (.txt).
3
Submission
Upload the following items on D2L dropbox, including:
1. The source code, including four java files:
(a) Message.java
(b) MessageTester.java
(c) Mailbox.java and
(d) MailboxTester.java
2. One program output file (containing the information similar to three figures).
Transcribed Image Text:5. Print out all messages in the mailbox object using printAllMessages () method. Your output should look like Figure 3. 4 Bluel: Terminal Window - 1_Solution Options Message list in the mailbox after removing six messages Message 1 From: Rudolf_C_Gouker To: Andy_R_Sayer This is test_message_7 Message 2 From: Zachary_B_Howard To: Craig Smith This is test_message_8 Can only enter input while your programming is running Figure 3: A screenshot of the program output 3. 2 Required outputs You should print out all three outputs as shown in Figures 1-3. Put them together (copy and paste) in one output file (.txt). 3 Submission Upload the following items on D2L dropbox, including: 1. The source code, including four java files: (a) Message.java (b) MessageTester.java (c) Mailbox.java and (d) MailboxTester.java 2. One program output file (containing the information similar to three figures).
2. Read all eight messages into Mailbox object from the file of "messages1.txt". The
values for each line will be used to initialize each instance variable of the Message
object, and then added into the Mailbox object.
Important: Your must read the values in from the file using Scanner object, you
are not allowed to initialize the objects manually.
3. Print out all messages using printAllMessages () method. Your output should look
like Figure 2.
Bluel: Terminal Window - 1 Solution
Options
Message list in the mailbox after loading from a file
Message 1
From: Eric_A_Bially
To: Zachary_B_Howard
This is_test_message_1
Message 2
From: Brett_V_Bohorquez
To: Marcus_R_McPartland
This is_test_message_2
Message 3
From: Aron_I_Brewster
To: Patrick_C_Nauman
This is_test_message_3
Message 4
From: Joshua_J_Dennis
To: Jacob_G_Neff
This_is_test_message_4
Message 5
From: Stephen_M_Gentzler
To: Kevin_A_0rlowski
This is_test_message_5
Message 6
From: Adam_James_D_Geosits
To: Oscar_J_Phillips
This is_test_message_6
Message 7
From: Rudolf_C_Gouker
To: Andy_R_Sayer
This_is_test_message_7
Message 8
From: Zachary_B_Howard
To: Craig_Smith
This is_test_message_8
Figure 2: A screenshot of the program output 2.
4. Remove message at position 0 (index) using removeMessage (), and repeat it six times.
Transcribed Image Text:2. Read all eight messages into Mailbox object from the file of "messages1.txt". The values for each line will be used to initialize each instance variable of the Message object, and then added into the Mailbox object. Important: Your must read the values in from the file using Scanner object, you are not allowed to initialize the objects manually. 3. Print out all messages using printAllMessages () method. Your output should look like Figure 2. Bluel: Terminal Window - 1 Solution Options Message list in the mailbox after loading from a file Message 1 From: Eric_A_Bially To: Zachary_B_Howard This is_test_message_1 Message 2 From: Brett_V_Bohorquez To: Marcus_R_McPartland This is_test_message_2 Message 3 From: Aron_I_Brewster To: Patrick_C_Nauman This is_test_message_3 Message 4 From: Joshua_J_Dennis To: Jacob_G_Neff This_is_test_message_4 Message 5 From: Stephen_M_Gentzler To: Kevin_A_0rlowski This is_test_message_5 Message 6 From: Adam_James_D_Geosits To: Oscar_J_Phillips This is_test_message_6 Message 7 From: Rudolf_C_Gouker To: Andy_R_Sayer This_is_test_message_7 Message 8 From: Zachary_B_Howard To: Craig_Smith This is_test_message_8 Figure 2: A screenshot of the program output 2. 4. Remove message at position 0 (index) using removeMessage (), and repeat it six times.
Expert Solution
Step 1

Hi... Please check below java code.

Mailbox.java

import java.util.List;

public class Mailbox {

private List<Message> all;

private int numOfMessages;

public List<Message> getAll() {

return all;

}

public void setAll(List<Message> all) {

this.all = all;

}

public int getNumOfMessages() {

return numOfMessages;

}

public void setNumOfMessages(int numOfMessages) {

this.numOfMessages = numOfMessages;

}

public Mailbox(List<Message> all, int numOfMessages) {

super();

this.all = all;

this.numOfMessages = numOfMessages;

}

public Message getMessage(int i){

return all.get(i-1);

}

public void removeMessages(int i){

all.remove(i-1);

}

public void printAllMessages(){

for(Message m:all){

System.out.println(m.getMessage());

}

}

}

Message.java

public class Message {

private String message;

public String getMessage() {

return message;

}

public void setMessage(String message) {

this.message = message;

}

public Message(String message) {

super();

this.message = message;

}

}

trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY