This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

PROBLEM !!!  RSS feed

 
bole bolat
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Gentlmen ;
I need your votes about this question
IS IT REALLY DIFICULT OR NOT ???
and.....
WHAT IS ITS CONCEPT ???
**************************************
The question is : write a Java program that will produce a Java file "Letter.java" that contain a complete Java class "Letter".

Assume you already have an interface called "Speakable" that contains one method: public void speak(); [with no parameters!]
Write a program that will automatically create the class Letter which contains one instance character variable: value and one constructor: Letter(char c){�}. Inside Letter there are 26 inner classes: LetterA, LetterB, LetterC, �, LetterZ, all of them extend Letter and implement Speakable.

THANKS ;
 
Shaan Shar
Ranch Hand
Posts: 1249
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by bole bolat:
Hi Gentlmen ;
I need your votes about this question
IS IT REALLY DIFICULT OR NOT ???
and.....
WHAT IS ITS CONCEPT ???
**************************************
The question is : write a Java program that will produce a Java file "Letter.java" that contain a complete Java class "Letter".

Assume you already have an interface called "Speakable" that contains one method: public void speak(); [with no parameters!]
Write a program that will automatically create the class Letter which contains one instance character variable: value and one constructor: Letter(char c){�}. Inside Letter there are 26 inner classes: LetterA, LetterB, LetterC, �, LetterZ, all of them extend Letter and implement Speakable.

THANKS ;


Howdy Bole Bolat (aldafry@gmail.com),

You should first check this .


And second thing is this is not a homework Forum, we will appreciate your efforts towards this exercise.

Let us show your efforts then we will correct you if somewhere it needed.

Hope you understand.
 
Svend Rost
Ranch Hand
Posts: 904
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. You need to create a class called Letter.
2. Inside Letter you need to have 26 inner classes which all implements the Speakable interface.
3. Make the Constructor: Letter(char c)

Wheater or not this is a hard question depends on the person who has to
implement it. If he's new to Java it might be hard whereas it would be a
simple problem for an expirienced Java programmer.

What have you done so far? and why cant you continue?

/Svend Rost
 
Chris Beckey
Ranch Hand
Posts: 116
Eclipse IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The simple answer is no, its not too difficult. Java source files are just text files. The classes you need to generate are reasonably simple.
Try working the problem backwards, i.e.
1.) start with an example result (i.e. the resulting java file including at least one inner class example),
2.) abstract the repeating parts
... the remainder is left as an exercise for the student.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!