Question: *PYTHON* Provide a class Letter for authoring a simple letter. In the constructor, supply the names of the sender and the recipient: def __init__(self, letterFrom,

*PYTHON* Provide a class Letter for authoring a simple letter. In the constructor, supply the names of the sender and the recipient:

def __init__(self, letterFrom, letterTo)

Supply a method

def addLine (self, line)

to add a line of text to the body of the letter.

Supply a method

def getText(self)

that returns the entire text of the letter.

The letter has the form:

Dear recipient name:

blank line

first line of the body

second line of the body

.

last line of the body

blank line

Sincerely,

blank line

sender name

For example, assuming that you have the sender named John and the recipient named Mary. John wrote two lines of the letter: 1: How are you? 2: I really miss you!

Your test file leveraging this Letter class will have the following output:

Dear Mary:

How are you?

I really miss you!

Sincerely,

John

Submit two files: 1: Letter class; 2: a test file

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!