Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Interpretor Pattern: Need Help

 
Deepak Lal
Ranch Hand
Posts: 561
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm writing a Java sample program for demonstrating interpretor design Pattern.





Can you please tell me how should i go about writing the "Note class and the Frequency class" for the above example.

How should i invoke the above class from my main method.I'm finding it difficult to proceed.
Need your help ??

Help provided will be appreciated.

--
Deepak Lal


 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where do you see the Interpreter design pattern in this example?
 
Deepak Lal
Ranch Hand
Posts: 561
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is an example of Interpretor design pattern.
The musical notes along with their frequencies is stored in the properties file.
By passing a Note,a corresponding frequency is retrieved and based on the frequency a corresponding sound is produced.

Please see the below link for reference.
http://www.allapplabs.com/java_design_patterns/interpreter_pattern.htm.

Can you tell me how should my Note class and Frequency class Look like and how should i write a main method such that it invokes the class. ?

--
Deepak Lal

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic