• Post Reply Bookmark Topic Watch Topic
  • New Topic

Form Letter Template  RSS feed

 
Carlos Diaz G
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Need Help with some part of a Homework Assignment on FormLetter in Java. Here is step 3 of Homework. Im pretty much new to Java so any help is appreciated.

Add fields and methods to the FormLetter class. These should include a container for FormLetterEntrys, appropriate constructors, and the methods outlined in the class starter.

Here is the code given, There are other parts of the code but this is the main thing Im confused about. We have other files that are FormLetterEntry.java and FormLetterHellow.java.
 
Rajdeep Biswas
Ranch Hand
Posts: 231
1
Eclipse IDE Java Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Carlos, welcome to the Ranch!
I am not clear on your problem statement. What have you tried and where are you stuck?
 
Carlos Diaz G
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rajdeep and thank you for the welcome.

Sorry about the confusion. So I have an assignment that I need to make a Form Letter work. We have been provided with the following code.

This is inside FormLetterEntry.java in this file I need to create the two derived classesTextEntry and DataItemEntry and make sure to implement all the abstract methods in each derived class.



What I added to the above code which I'm not sure if it's correct and getting an error


After this step 2 is what I need to work on which is from the first post above, Add fields and methods to the FormLetter class. These should include a container for FormLetterEntrys, appropriate constructors, and the methods outlined in the class starter. I need to make FromLetterHellow.java compile and run.
 
Rajdeep Biswas
Ranch Hand
Posts: 231
1
Eclipse IDE Java Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is inside FormLetterEntry.java in this file I need to create the two derived classes TextEntry and DataItemEntry and make sure to implement all the abstract methods in each derived class.


So this means that you have been given the abstract base class FormLetterEntry.java and need to extend this 'abstract' class to create two 'concrete' classes:
1. TextEntry
2. DataItemEntry

So basically, there are some mistakes that you can rectify as follows:

1. Write two different classes with all abstract methods from base classes, and implement them.
Implementing means
1.1. giving a definition, as you see in base classes, being abstract, there is no definition, and then
1.2. removing the 'abstract' keyword (since you made your implementations 'concrete')

So for your example, I think you need to write console outputs mentioning current behavior.

2. Write another app class to drive the behavior or test your application.

I am just giving an example, so you must derive what you are trying to do. But studying first about the meaning of abstracts and their concrete implementations is most important to you.
The headway is:



Other mistakes that you did are:
You naming the class 'Derived' when you are given proper names in problem statement.
You implemented all methods by giving them body or definition but still left them and the class 'abstract', which is wrong.
You wrote the driver class inside the extended class (derived from base class). The driver or test class has to be different from your design.

And as I said, if you still have doubts, you need more theory and can get started with any free course available on google.

Hope that helps.
 
Carlos Diaz G
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you, I will look into further. If I have anymore questions I will post them here.
 
Liutauras Vilda
Marshal
Posts: 4657
319
BSD
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.

Well, FIRST you need to understand WHAT you need to do. This is the first thing you should concetrate on - understand instructions. Writing actual Java code should be the latest part in your assignment you have to do.

Did you get instructions in the form of Java source file comments only? Do you have somewhere else instructions written? Post them here.
These usually being divided into the parts. Tell us how the first instructions part sound, better if you copy and paste them without your own interpretations.

You showed us written class Derived, you wrote it? That one probably you'll need to bin it.

Yes, please post the instructions, we won't be able to help you otherwise.
 
Carlos Diaz G
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi sorry for the confusion, but here is the instructions on what to do? http://mysite.du.edu/~mschwart/ICT4361/javahw5a.pdf If link doesn't work I can copy and paste the instructions.
 
Liutauras Vilda
Marshal
Posts: 4657
319
BSD
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, these instructions tells more than comments within the source file.

Please show what progress you have made.
 
Carlos Diaz G
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you all for your help, in the end I managed to figure it out
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!