Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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.

Step by Step Solution

3.52 Rating (159 Votes )

There are 3 Steps involved in it

Step: 1

Letterjava package myPackage import javalang public class Letter String from String t... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Microeconomics An Intuitive Approach with Calculus

Authors: Thomas Nechyba

1st edition

538453257, 978-0538453257

More Books

Students also viewed these Programming questions

Question

Describe diversitybased conflict.

Answered: 1 week ago

Question

Define intractable issue.

Answered: 1 week ago

Question

Explain the difference between nationalism and patriotism.

Answered: 1 week ago