Provide a class for authoring a simple letter. In theconstructor, supply the names of the sender and
Question:
Provide a class for authoring a simple letter. In theconstructor, supply the names of the sender and therecipient:
public Letter(String from, String to)
Supply a method
public void addLine(String line)
to add a line of text to the body of the letter.
Supply a method
public String getText( )
That returns the entire text of the letter. The text has theform:
Dear recipientname:
blankline
firstline of the body
second line of thebody
.....
last line of thebody
blankline
sincerely,
blankline
sendername
Also supply a program LetterPrinter that prints thisletter.
Dear John:
I am sorry we must part.
I wish you all the best
Sincerely,
Mary
Construct an object of the letter class and call addLinetwice.
Microeconomics An Intuitive Approach with Calculus
ISBN: 978-0538453257
1st edition
Authors: Thomas Nechyba