• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

can not find symble

 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hay friends please help me.i am new in java and making a program of" tower of Hanoi" but it is not compiling and giving me an error please check it and feed me back thanks in advance.


 
Ranch Hand
Posts: 93
Eclipse IDE VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Numan,

You are using recursion here. you should have a method in the class called towerofhanoi(), which takes in four arguments that you are passing here , i.e. towerofhanoi(n - 1, beg, end, aux); Hope this helps.

-Aditya
 
lowercase baba
Posts: 13089
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It would be of tremendous help if you posted the exact text of the error.
 
numan ahmad
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Aditya Sirohi wrote:Hi Numan,

You are using recursion here. you should have a method in the class called towerofhanoi(), which takes in four arguments that you are passing here , i.e. towerofhanoi(n - 1, beg, end, aux); Hope this helps.

-Aditya


yes i am using recursion but sorry i did not get you exactly


please help me and reply me I wouldn't be here if I didn't need help.....
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
On lines 13, 19 and 22, are the calls to:

towerofhanoi(n, beg, aux, end)

supposed to be methods or constructors. What relevance is there to the arguments passed to them and the instance variables of the same name in the class?

This code fragment doesn't contain enough info to be sure which error you're talking about?
 
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Pauly Bradley, welcome to the Ranch
 
numan ahmad
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

pauly bradley wrote:On lines 13, 19 and 22, are the calls to:

towerofhanoi(n, beg, aux, end)

supposed to be methods or constructors. What relevance is there to the arguments passed to them and the instance variables of the same name in the class?

This code fragment doesn't contain enough info to be sure which error you're talking about?



thanks



i did it but its not working again


 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
towerofhanoi is an instance method of class tower. That means you need an instance of tower to call that method.
 
fred rosenberger
lowercase baba
Posts: 13089
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

numan ahmad wrote:
i did it but its not working again


please consider reading ItDoesntWorkIsUseless. What you have posted really doesn't help us help you at all.

Does it compile? does it crash when you run it? Does it run but gives the wrong output?

Your job when asking a question is to make it as EASY as possible for me to help you. simply posting 30 lines of code and saying "this doesn't work" makes it quite HARD for me to help you.
 
numan ahmad
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

fred rosenberger wrote:

numan ahmad wrote:
i did it but its not working again


please consider reading ItDoesntWorkIsUseless. What you have posted really doesn't help us help you at all.

Does it compile? does it crash when you run it? Does it run but gives the wrong output?

Your job when asking a question is to make it as EASY as possible for me to help you. simply posting 30 lines of code and saying "this doesn't work" makes it quite HARD for me to help you.



hmmm yesterday my class teacher gave me an assignment of tower of Hanoi...before this he gave me an overview and understand its algorithm.....when i start coding and compile it first time it gave me an error of that symbol not find (symble1 method not find).after that i made a method in it i.e tower() and compile it got an error which was something like that

tower.java:7: ';' expected
tower(){
tower.java:12: '.class' expected



now sir please told me where i am wrong and what should i have to do in it....?
 
numan ahmad
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rob Spoor wrote:towerofhanoi is an instance method of class tower. That means you need an instance of tower to call that method.





but i am implementing it by using stack respected sir according to my knowledge in stack there is no instance of class.....?? is am i rite?
 
fred rosenberger
lowercase baba
Posts: 13089
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's because this line:



doesn't make any sense. What are you trying to do here - define a method? Call one? create a new class? declare a member variable?

reply
    Bookmark Topic Watch Topic
  • New Topic