Question: PYTHON CODE ONLY Objects and Classes Creating an e-mail Message Class Understand the Application e-mail. How we often communicate todayfrom Christmas lists, to pick up
PYTHON CODE ONLY
Objects and Classes
Creating an e-mail Message Class
Understand the Application
e-mail. How we often communicate todayfrom Christmas lists, to pick up from the store lists, to-do lists, to one-liner messagesall examples of communication using an e-mail message.
Specifically we will write a Python3 program that will implement a simple class that will model an e-mail message.
The Program Spec
The task for this lab is to design and implement a class that will model an e-mail message. You will define the Message class. The Message will include a sender, recipient and body. The sender is the originator of the email message. The recipient is the receiver of the message. The body contains the text of the message.
Provide the following methods for the Message class:
A constructor with parameters self, sender and recipient. Set values for sender and recipient. Set body as an empty string.
A method append with parameters self and line. line contains the line of text to add to the body of the message. End message line with a newline character.
A method toString: Returns a string representation of the entire message. The entire message includes the sender, the recipient and the body of the message. Example: From: Student One To: Student Two Lunch today?
Attached is a program that uses this class to create an e-mail message and print it.
Deliverable: yournameLab7.py Your source code solution and a copy of the run pasted into your source submission file. Be sure to comment out your run so that your .py file will still run in the grader test bed.
Input Error Checking: For simplicity a valid python file is provided to use your class. The filename is demo_message.py provided in webAccess.
Test Run Requirements: Use the provided demo_message.py file as your test run validator.
Here are some other tips and requirements:
1. Name the class Message
2. To run demo_message.py you will need to change CIS_117_Lab7Soln to the name of your deliverable (i.e. yournameLab7.py)
3. Update the provided program test file demo_message.py recipient name to your name (i.e. name Ann should be changed to your first name).
4. Run the demo_message.py program to use your class to make a Message and generate submission run output
Here is a sample run:
From: Ann
To: Santa
For Christmas, I would like:
Video games
World peace
demo_message.py

##
# Demonstrate the Message class.
#
from CIS_117_Lab7Soln import Message
# Create the message.
wishList = Message("Ann", "Santa")
wishList.append("For Christmas, I would like:")
wishList.append("Video games")
wishList.append("World peace")
# Display its contents.
print(wishList.toString())
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
