-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
20,639 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package uta.cse3310; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class Chat { | ||
private String name; | ||
private String message; | ||
|
||
private List<Message> chatMessages; | ||
|
||
public Chat() { | ||
this.chatMessages = new ArrayList<>(); | ||
} | ||
|
||
public void addMessage(String name, String message) { | ||
Message newMessage = new Message(name, message); | ||
chatMessages.add(newMessage); | ||
} | ||
|
||
public void displayMessages() { | ||
for (Message msg : chatMessages) { | ||
System.out.println(msg.getName() + ": " + msg.getMessage()); | ||
} | ||
} | ||
|
||
private class Message { | ||
private String name; | ||
private String message; | ||
|
||
public Message(String name, String message) { | ||
this.name = name; | ||
this.message = message; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public String getMessage() { | ||
return message; | ||
} | ||
} | ||
} |
Oops, something went wrong.