Answered step by step
Verified Expert Solution
Question
1 Approved Answer
5. (10 points) Create a class called Message that models an email message. A message has a recipient, a sender and a message text. It
5. (10 points) Create a class called Message that models an email message. A message has a recipient, a sender and a message text. It also has a Class/Static variable called numMessage. a. An email message has three properties: sender, recipient and text. IT 2045 Project 2 Spring 2021 b. Write a constructor that takes a sender and a recipient as arguments. It also increments the class variable by 1. c. Write a method append that adds/sets text to the message text. Should this method have any arguments or return a value? Is this a mutator or an accessor method? d. Write a method composeMessage that formats the recipient, sender and message text into one long string like this "From: Harry Morgan To: Mary Smith Message:..." and returns it. Should this method have any arguments or return a value? Is this a mutator or an accessor method? e. Print the class/static variable in your Tester class. Tester Class 6. (15 points) Implement a P2Tester class (with main method) that will test all the classes and all its methods. Below is a general pattern you can follow but make necessary adjustments according to the class: a. Create object from class b. Print the instance variables c. Modify the instance variables d. Print the instance variables again e. Repeat Steps b-d if there are multiple methods that modify the instance variables of the object
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started