February 27, 2017

Homework Help: java programming

Posted by JJ on Thursday, January 20, 2011 at 5:41am.

Provide a class called Letter for authoring a simple letter. The letter class has three data fields, the name of the sender, the name of the recipient, a body of the letter.
1. Supply the class constructors (default , and overloaded )
2. Supply a method.
Public void addLine (String Line)

To add a line of text to the body of the letter
The addLine method should through an exception if the line is empty.
3. Supply a method.
Public String getText()

That returns the entire text of the letter.The text 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
Blank line
Sender name
4. Also supply a program LetterPrinter that asks the user to enter lines of text nd verifies that the lines are not empty and prints the following letter :
Dear teacher:
Line supplied by the user
Line supplied by the user

Student name

Answer This Question

First Name:
School Subject:

Related Questions

More Related Questions