Question: JAVA PLEASE Design a class Message that models an e-mail message. A message has a recipient, a sender, and a message text as data members.
Design a class Message that models an e-mail message. A message has a recipient, a sender, and a message text as data members. The class support the following methods: a. A constructor that takes the sender and recipient b. A method set Message that allows to enter a message from the keyboard. c. A method toString that displays the Sender, Recipient, and the Message. A driver program and a sample run are provided below. import java.util."; public class Q 13 public static vold main(String] args) Scanner Input= new Scanner(System.in); String sender,recipient; System.out.println("Enter sender's name": sender input.nextLine(); System.out.println("Enter recipient's name": recipient = input.nextLine(): Message mi-new Message(sender recipient); m1.setMessagell: System.out.println(ml): Sample run: public static class Message Enter sender's name: Professor Assadipour Enter recipient's name: CS 102 Students Enter Message: Your 2nd hwk is due next week. public Message(Strings, String Sender: Professor Assadipour Reciplent: CS 102 Students Message: Your 2nd hwk is due next week. public ........... Set Message() public ........toString
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
