Help with this easy Java pgm

Could someone pls pop in the codes in the comments below. Ive tried a lot but i always get these crazy errors while compiling ,which i can t figure out .

Thanx a ton !!!

import java.util.*;

import abc.*;

public class MessageSkeleton{

// instance variables

private String toAddress;

private String fromAddress;

private String subject;

private String[] messageBody;

private int messageLines;

private int maxLines;

private String recievedDate;

private String sentDate;

// constructor - builds a blank message

public MessageSkeleton(int max)

{

// set sentDate and recievedDate to be null

sentDate = "null";

recievedDate = "null";

// set toAddress, fromAddress, and subject to be null

toAddress = "null";

fromAddress = "null";

// set messageLines to be 0

messageLines = 0;

// set maxLines to be the parameter passed to constructor

maxLines = max;

// set messageBody array to have maxLines elements

messageBody = new String[maxLines];

}

// compose method that allows the user to enter data into the email message

public void compose(String myAddress)

{

// declare some variables that will be used in the constructor

int lineCounter;

boolean moreInput = true;

String inputString;

// create new Easy Reader object to read data from keyboard

EasyReader keyboard = new EasyReader();

System.out.println("New message is from " + myAddress);

fromAddress = myAddress;

// get recipient email address

System.out.print("Please enter recipient address ");

toAddress = getAddress( keyboard );

// get subject

// add your own code here to read the message subject from the keyboard

// get mail body text

System.out.println("Please enter the email text, line by line");

System.out.println("You can enter a maximum of " + maxLines + " lines of text, enter '.' to finish");

lineCounter = 0;

while (moreInput == true)

{

// add your own code here to read the message body from the keyboard

}

}

// print method

public void printToScreen()

{

int lineCounter;

String dashLine = "--";

System.out.println(dashLine);

System.out.println("To:" + toAddress);

System.out.println("From:" + fromAddress);

System.out.println("\n" + dashLine);

System.out.println("Sent:" + sentDate);

System.out.println("Recieved: " + recievedDate);

System.out.println("\n" + dashLine );

System.out.println("Subject: " + subject);

System.out.println("\n" + dashLine + "\n");

for (lineCounter = 0; lineCounter <= messageLines-1; lineCounter++)

{

System.out.println(lineCounter+1 + " " + messageBody[lineCounter]);

}

}

// edit method

// each part of the message is edited in turn

public void edit()

{

EasyReader keyboard = new EasyReader();

String response;

// edit recipient

String newRecipient;

System.out.println("Edit recipient");

System.out.println("Recipient is currently "+getToAddress());

System.out.print("Change (Y/N)?");

response = getKeyboardChar( keyboard );

if (response.equals("y"))

{

newRecipient = getAddress( keyboard );

setToAddress(newRecipient);

}

// edit subject

// add your own code here allow the user to edit the subject

// edit body

String newLine;

System.out.println("Edit message body, one line at a time");

// add your own code here allow the user to edit the message body

}

private String getKeyboardChar(EasyReader keyboard)

{

String response;

response = keyboard.readString();

response = response.toLowerCase();

response = response.substring(0,1);

return response;

}

private String getAddress( EasyReader keyboard )

{

String address = keyboard.readString();;

boolean formatOK = false;

while (formatOK == false)

{

// check it is a valid email addressxxxx@yyyy

if (address.indexOf('@') == -1)

{

System.out.print("Email address should contain @, please try again ");

address = keyboard.readString();

}

else

{

formatOK = true;

}

}

return address;

}

// get methods

public String getSubject()

{

return subject;

}

public String getToAddress()

{

return toAddress;

}

public String getFromAddress()

{

return fromAddress;

}

public String[] getMessageBody()

{

return messageBody;

}

public String getSentDate()

{

return sentDate;

}

public String getRecievedDate()

{

return recievedDate;

}

public int getMessageLines()

{

return messageLines;

}

// set methods

public void setSubject( String newSubject )

{

subject = newSubject;

}

public void setToAddress( String newAddress )

{

toAddress = newAddress;

}

public void setFromAddress(String newAddress )

{

fromAddress = newAddress;

}

public void setMessageLines( int newMessageLines )

{

messageLines = newMessageLines;

}

public int setMessageBodyLine(String newLine, int lineNumber)

{

if ((lineNumber > messageLines)||(lineNumber < 0))

{

return 0; // error

}

else

{

messageBody[lineNumber] = newLine;

return 1; // success

}

}

public void setRecievedDate(String newDate)

{

recievedDate = newDate;

}

public void setSentDate(String newDate)

{

sentDate = newDate;

}

}

[5939 byte] By [Jeevoa] at [2007-10-2 5:48:03]
# 1
could you tell us which part of the code is yours and what errors you are getting.also use code tags as explained here.[url http://forum.java.sun.com/help.jspa?sec=formatting]formatting tips[/url]kind regardsArbie
Arbiea at 2007-7-16 1:57:36 > top of Java-index,Java Essentials,Java Programming...
# 2

import java.util.*;

import abc.*;

public class MessageSkeleton{

// instance variables

private String toAddress;

private String fromAddress;

private String subject;

private String[] messageBody;

private int messageLines;

private int maxLines;

private String recievedDate;

private String sentDate;

// constructor - builds a blank message

public MessageSkeleton(int max)

{

// set sentDate and recievedDate to be null

sentDate = "null";

recievedDate = "null";

// set toAddress, fromAddress, and subject to be null

toAddress = "null";

fromAddress = "null";

// set messageLines to be 0

messageLines = 0;

// set maxLines to be the parameter passed to constructor

maxLines = max;

// set messageBody array to have maxLines elements

messageBody = new String[maxLines];

}

// compose method that allows the user to enter data into the email message

public void compose(String myAddress)

{

// declare some variables that will be used in the constructor

int lineCounter;

boolean moreInput = true;

String inputString;

// create new Easy Reader object to read data from keyboard

EasyReader keyboard = new EasyReader();

System.out.println("New message is from " + myAddress);

fromAddress = myAddress;

// get recipient email address

System.out.print("Please enter recipient address ");

toAddress = getAddress( keyboard );

// get subject

// add your own code here to read the message subject from the keyboard

// get mail body text

System.out.println("Please enter the email text, line by line");

System.out.println("You can enter a maximum of " + maxLines + " lines of text, enter '.' to finish");

lineCounter = 0;

while (moreInput == true)

{

// add your own code here to read the message body from the keyboard

}

}

// print method

public void printToScreen()

{

int lineCounter;

String dashLine = "--";

System.out.println(dashLine);

System.out.println("To: " + toAddress);

System.out.println("From: " + fromAddress);

System.out.println("\n" + dashLine);

System.out.println("Sent: " + sentDate);

System.out.println("Recieved: " + recievedDate);

System.out.println("\n" + dashLine );

System.out.println("Subject: " + subject);

System.out.println("\n" + dashLine + "\n");

for (lineCounter = 0; lineCounter <= messageLines-1; lineCounter++)

{

System.out.println(lineCounter+1 + " " + messageBody[lineCounter]);

}

}

// edit method

// each part of the message is edited in turn

public void edit()

{

EasyReader keyboard = new EasyReader();

String response;

// edit recipient

String newRecipient;

System.out.println("Edit recipient");

System.out.println("Recipient is currently "+getToAddress());

System.out.print("Change (Y/N)?");

response = getKeyboardChar( keyboard );

if (response.equals("y"))

{

newRecipient = getAddress( keyboard );

setToAddress(newRecipient);

}

// edit subject

// add your own code here allow the user to edit the subject

// edit body

String newLine;

System.out.println("Edit message body, one line at a time");

// add your own code here allow the user to edit the message body

}

private String getKeyboardChar(EasyReader keyboard)

{

String response;

response = keyboard.readString();

response = response.toLowerCase();

response = response.substring(0,1);

return response;

}

private String getAddress( EasyReader keyboard )

{

String address = keyboard.readString();;

boolean formatOK = false;

while (formatOK == false)

{

// check it is a valid email addressxxxx@yyyy

if (address.indexOf('@') == -1)

{

System.out.print("Email address should contain @, please try again ");

address = keyboard.readString();

}

else

{

formatOK = true;

}

}

return address;

}

// get methods

public String getSubject()

{

return subject;

}

public String getToAddress()

{

return toAddress;

}

public String getFromAddress()

{

return fromAddress;

}

public String[] getMessageBody()

{

return messageBody;

}

public String getSentDate()

{

return sentDate;

}

public String getRecievedDate()

{

return recievedDate;

}

public int getMessageLines()

{

return messageLines;

}

// set methods

public void setSubject( String newSubject )

{

subject = newSubject;

}

public void setToAddress( String newAddress )

{

toAddress = newAddress;

}

public void setFromAddress(String newAddress )

{

fromAddress = newAddress;

}

public void setMessageLines( int newMessageLines )

{

messageLines = newMessageLines;

}

public int setMessageBodyLine(String newLine, int lineNumber)

{

if ((lineNumber > messageLines)||(lineNumber < 0))

{

return 0; // error

}

else

{

messageBody[lineNumber] = newLine;

return 1; // success

}

}

public void setRecievedDate(String newDate)

{

recievedDate = newDate;

}

public void setSentDate(String newDate)

{

sentDate = newDate;

}

}

H_javaa at 2007-7-16 1:57:36 > top of Java-index,Java Essentials,Java Programming...
# 3
I would like to know what is the package import abc.* you are using.....One more thing write some description about the program in few line..
H_javaa at 2007-7-16 1:57:36 > top of Java-index,Java Essentials,Java Programming...
# 4

> Could someone pls pop in the codes in the comments

> below. Ive tried a lot but i always get these crazy

> errors while compiling ,which i can t figure out .

Well, read them, carefully. Try to understand what they might be telling you. Look closely at the line they're talking about (or in some cases, the preceding line).

They're not there to punish you. They're there to help you. They're telling you--in some detail--about a mistake you've made.

If you can't figure them out, then copy/paste them here (don't expect others to try to compile or run your code) and tell us which lines they're talking about.

When you post code, please use[code] and [/code] tags as described in [url=http://forum.java.sun.com/help.jspa?sec=formatting]Formatting tips[/url] on the message entry page. It makes it much easier to read.

targaryena at 2007-7-16 1:57:36 > top of Java-index,Java Essentials,Java Programming...
# 5
And don't ask others to do your work for you. That's not what people come here for.
targaryena at 2007-7-16 1:57:36 > top of Java-index,Java Essentials,Java Programming...
# 6
Thanx guys i m trying to do this by my own and understand it more in detail. Thanx for ur help though !Cheers!
Jeevoa at 2007-7-16 1:57:37 > top of Java-index,Java Essentials,Java Programming...
# 7
Thanks.
.u...j...a at 2007-7-16 1:57:37 > top of Java-index,Java Essentials,Java Programming...