Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Why won't my program compile?

  1. #1
    Member
    Join Date
    Feb 2013
    Posts
    30
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default Why won't my program compile?

    Hello!

    I have researched and worked on my code for days and I still can't figure out why I am receiving an error. Please help if you can!

    This is the program to be designed:
    Write a query method public boolean sameNumber (Vic par) for Looper: The executor tells whether it has the same number of CDs in its slots as the Vic parameter. Do not use numeric variables. Hint: Advance each to the next nonempty slot. Repeat this until one runs out of slots. Does the other?

         public boolean sameNumber (Vic par)
         {  String thisSpot = this.getPosition();
            String parSpot = par.getPosition();
            while (this.seesSlot() && par.seesSlot())
                {   if (this.seesCD() && par.seesCD())
                        { this.moveOn();
                          par.moveOn();
                        }
                    if (this.seesCD() && ! par.seesCD())
                        this.moveOn();
                    if ( ! this.seesCD() && par.seesCD())
                        par.moveOn();
                    if ( ! this.seesCD() && ! par.seesCD())
                        {  this.moveOn();
                           par.moveOn();
                        }
                }
     
             boolean valueToReturn = ! this.seesSlot() && ! par.seesSlot();
     
             this.backUpTo (thisSpot);
             par.backUpTo (parSpot); 
     
             return valueToReturn;  
         }


    I have attached the entire folder. When I compile I receive the following error:

    cannot find symbol - method backUpTo(java.lang.String)

    Exercise 3.34.zip

    Thank you so much for all the help!


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: Why won't my program compile?

    There is a problem with one of these (or both) calls:

    this.backUpTo (thisSpot);
    par.backUpTo (parSpot);

    (the 'this' is probably unnecessary but can't be sure. i'd be curious to see why you think it's necessary.)

    You didn't tell us which line (or both) was causing the error. This error:

    cannot find symbol - method backUpTo(java.lang.String)

    means "there's no such method called "backUpTo()" that takes a String as a parameter" (within the same 'scope' or within visibility of the calls).

    Recommendation: Fix it.

    If you still don't know how, then post the entire class that includes the method backUpTo().

Similar Threads

  1. Why won't my program compile? (While loop with inputs)
    By LWorm in forum Loops & Control Statements
    Replies: 5
    Last Post: October 14th, 2013, 10:52 PM
  2. Java won't compile
    By headhenchmanhollywood in forum What's Wrong With My Code?
    Replies: 3
    Last Post: March 31st, 2013, 09:25 PM
  3. Replies: 8
    Last Post: February 12th, 2013, 05:45 AM
  4. program won't compile, can't get data from google analytics
    By nervous in forum What's Wrong With My Code?
    Replies: 3
    Last Post: June 20th, 2012, 11:57 PM
  5. *why won't this compile?*
    By dcshoecousa in forum What's Wrong With My Code?
    Replies: 6
    Last Post: November 2nd, 2010, 07:18 PM

Tags for this Thread