Can't figure out simple error message

     public int findAccount(int accountNum)
          int i;
          for(i = 0; i < accountCount; i++)
          if(accounts[i] = accounts[accountNum])
                    return i;
          else
               return -1;
It gives me this error message:
C:\bank\Bank.java:79: incompatible types
found : support.BankAccount
required: boolean
               if(accounts[i] = accounts[accountNum])
^
1 error
the source code didn't put the post right, it should have the array accounts with the i index, I'm sure you know what I mean, its only putting accounts

Actually, it should be:
for(i = 0; i < accountCount; i++){
if(accounts == accounts[accountNum])
return i;
else
return -1;
to correct the syntax error. You may still have logic errors but this clears up the syntax error. Note the DOUBLE equals, in Java conditionals and iterators must take booleans (no auto-downcasting), in addition, the double equals only checks for reference equality, not value equality. To check for value equality between objects, you should use foo.equals(bar) and overload equals(). Hope this helps.
silentOpen

Similar Messages

  • Whenever I text this one person, his messages come up green. He has an iPhone and so do I, I can't figure out why our messages are green

    Whenever I text this one person, his messages come up green. He has an iPhone and so do I, I can't figure out why our messages are green
    We've tried reactivating iMessage, deleting threads, and contacts but nothing seems to work. Has this happened to anyone else?

    Restart both devices (press the HOME and power button until the Apple logo appears then releasae).  If both devices have iMessage turned on and to send as SMS when iMessage is not available, the the green messages are indicative of iMessage not being available on one or both devices. 

  • Can't figure out my errors

    // Rectangle.java                                              
    public class Rectangle
        private double width;
        private double length;
        private double area;
        private double perimeter;
        public void double setWidth(x)     **********
            width = (x > 0.0 && x < 20.0)w ?: 1;
        public void double setLength(y)
            length = (y > 0.0 && y < 20.0)y ?: 1;
        public double getWidth()
        return width;
        public double getLength()
            return length;
        public double cArea()
            area = length * width;
            return area;
        public double cPerimeter()
            perimeter = (2 * length) + (2 * width);
            return perimeter;
    }       ^^^^^^^^^^at ********** I am getting <identifer> expected
    and at ^^^^^^^^^^ I am getting '(' expected
    please help!
    Message was edited by:
    Green_Ops
    Message was edited by:
    Green_Ops
    null

    ok, I have made some changes to the code, which is all I've been doing for the past couple days trying to figure this out.
    I made all the changes that you guys pointed out. But I'm still getting the same errors, in the same places. And what I don't understand, is that I have the same code declaring another method, (setLength), and that one doesn't have the error. ???
    // Rectangle.java                                               Phillip Barrios
    public class Rectangle
        private double width;
        private double length;
        private double area;
        private double perimeter;
        public void double setWidth(double x)
            width = (x > 0.0 && x < 20.0)x ?: 1;
        public void double setLength(double y)
            length = (y > 0.0 && y < 20.0)y ?: 1;
        public double getWidth()
        return width;
        public double getLength()
            return length;
        public double cArea()
            area = length * width;
            return area;
        public double cPerimeter()
            perimeter = (2 * length) + (2 * width);
            return perimeter;
    }

  • Can't figure out this error...

    The assignment is to create a program that uses a class to store information about DVDs and then diplay the information.
    One error is "cannot find symbol, symbol: constructor Dvd(), location: class Dvd, Dvd mydvd = new Dvd();
    The other error is "cannot find symbol, symbol method calculateValue(), location class DvdTest, System.out.println("The value in inventory is $", calculateValue() );
    Here's my code:
    {code// EmployeeInfo class created by Michelle Groves
    // Last edited April12 09
    public class DvdTest
       public static void main(String args [])
    Dvd mydvd = new Dvd();
    Dvd[] prodArray = new Dvd[2]; // creat an array
    prodArray[0] = new Dvd( 231562, 7.49, 2, "Cars" );
    prodArray[1] = new Dvd( 231562, 7.49, 2, "Toy Story" );
    // Displays first element's info
    System.out.println("The stock number is " + prodArray[0].getstockedDvds());
    System.out.println("Priced at " + prodArray[0].getdvdPrice());
    System.out.println("Inventory contains " + prodArray[0].getstockedDvds());
    System.out.println("The title is " + prodArray[0].getdvdName());
    // Displays second element's info
    System.out.println("The stock number is " + prodArray[1].getstockedDvds());
    System.out.println("Priced at " + prodArray[1].getdvdPrice());
    System.out.println("Inventory contains " + prodArray[1].getstockedDvds());
    System.out.println("The title is " + prodArray[1].getdvdName());
    System.out.println("The value in inventory is $", calculateValue() );
    } //end main
    } // end class
    class Dvd
    private int dvdNumber; // DVD Product Number
    private double dvdPrice; // price of DVD
    private double stockedDvds; // number of units in stock
    private String dvdName; // name of DVD
    public Dvd( int dvdNumber, double dvdPrice, double stockedDvds,
    String dvdName ) // constructor for dvd
    dvdNumber = 0;
    dvdPrice = 0.0;
    stockedDvds = 0.0;
    dvdName = "";
    } // end constructor
    // method to set DVD number
    public void setdvdNumber( int dvdNumber )
    dvdNumber = dvdNumber; // store DVD number
    } // end method setdvdNumber
    // method to retrieve DVD number
    public double getdvdNumber()
    return dvdNumber;
    } // end method getdvdNumber
    // method to set DVD price
    public void setdvdPrice( double dvdPrice )
    dvdPrice = dvdPrice;
    } // end method setdvdPrice
    // method to retrieve DVD price
    public double getdvdPrice()
    return dvdPrice;
    } // end method getdvdPrice
    // method to set stocked number of DVDs
    public void setstockedDvds( double stockedDvds )
    stockedDvds = stockedDvds;
    } // end method setstockedDvds
    // method to retrieve stocked number of DVDs
    public double getstockedDvds()
    return stockedDvds;
    } // end method getstockedDvds
    // method to set DVD Name
    public void setdvdName( String dvdName )
    dvdName = dvdName;
    } // end method setdvdName
    // method to retrieve DVD name
    public String getdvdName()
    return dvdName;
    } // end method getstockedDvds
    // method to calculate pay for week
    public double calculateValue()
    return dvdPrice * stockedDvds;
    } // end method total
    } // end class

    Here's my code a little more readable:
    // EmployeeInfo class created by Michelle Groves
    // Last edited April12 09
    public class DvdTest
    public static void main(String args [])
    Dvd mydvd = new Dvd();
    Dvd[] prodArray = new Dvd[2]; // creat an array
    prodArray[0] = new Dvd( 231562, 7.49, 2, "Cars" );
    prodArray[1] = new Dvd( 231562, 7.49, 2, "Toy Story" );
    // Displays first element's info
    System.out.println("The stock number is " + prodArray[0].getstockedDvds());
    System.out.println("Priced at " + prodArray[0].getdvdPrice());
    System.out.println("Inventory contains " + prodArray[0].getstockedDvds());
    System.out.println("The title is " + prodArray[0].getdvdName());
    // Displays second element's info
    System.out.println("The stock number is " + prodArray[1].getstockedDvds());
    System.out.println("Priced at " + prodArray[1].getdvdPrice());
    System.out.println("Inventory contains " + prodArray[1].getstockedDvds());
    System.out.println("The title is " + prodArray[1].getdvdName());
    System.out.println("The value in inventory is $", calculateValue() );
    } //end main
    } // end class
    class Dvd
    private int dvdNumber; // DVD Product Number
    private double dvdPrice; // price of DVD
    private double stockedDvds; // number of units in stock
    private String dvdName; // name of DVD
    public Dvd( int dvdNumber, double dvdPrice, double stockedDvds,
    String dvdName ) // constructor for dvd
    dvdNumber = 0;
    dvdPrice = 0.0;
    stockedDvds = 0.0;
    dvdName = "";
    } // end constructor
    // method to set DVD number
    public void setdvdNumber( int dvdNumber )
    dvdNumber = dvdNumber; // store DVD number
    } // end method setdvdNumber
    // method to retrieve DVD number
    public double getdvdNumber()
    return dvdNumber;
    } // end method getdvdNumber
    // method to set DVD price
    public void setdvdPrice( double dvdPrice )
    dvdPrice = dvdPrice;
    } // end method setdvdPrice
    // method to retrieve DVD price
    public double getdvdPrice()
    return dvdPrice;
    } // end method getdvdPrice
    // method to set stocked number of DVDs
    public void setstockedDvds( double stockedDvds )
    stockedDvds = stockedDvds;
    } // end method setstockedDvds
    // method to retrieve stocked number of DVDs
    public double getstockedDvds()
    return stockedDvds;
    } // end method getstockedDvds
    // method to set DVD Name
    public void setdvdName( String dvdName )
    dvdName = dvdName;
    } // end method setdvdName
    // method to retrieve DVD name
    public String getdvdName()
    return dvdName;
    } // end method getstockedDvds
    // method to calculate pay for week
    public double calculateValue()
    return dvdPrice * stockedDvds;
    } // end method total
    } // end class

  • Error in exception can't figure out why?

    hi
    iam new to oracle ..can't figure out the error in this code..
    set serveroutput on
    declare
    e_m exception;
    pragma_exception_init(e_m,-1400);
    begin
    insert into dept_dup(dno) values(nULL);
    exception
    when e then
    raise_application_error(-20000,'exception e');
    end;
    thank u
    rajiv

    This compiles OK:
    SQL>
    SQL> set serveroutput on
    SQL>
    SQL> drop table dept_dup;
    Table dropped.
    SQL>
    SQL> create table dept_dup(dno number);
    Table created.
    SQL>
    SQL> declare
      2  e_m exception;
      3  pragma exception_init(e_m,-1400);
      4  begin
      5  insert into dept_dup(dno) values(NULL);
      6  exception
      7  when e_m then
      8  raise_application_error(-20000,'exception em');
      9  end;
    10  /
    PL/SQL procedure successfully completed.
    SQL> show errors
    No errors.
    SQL>
    SQL> exitReading the PL/SQL docs can also help: http://download-uk.oracle.com/docs/cd/B19306_01/appdev.102/b14261/errors.htm#sthref2000
    Message was edited by:
    Pierre Forstmann

  • I uninstalled Firefox once, reinstalled it and it ran. I had a problem so I did it again. Now it will not run and I get an error message saying that firefox is running and you can only run one at a time. I can't figure out what is running.

    Because of a problem, I uninstalled Firefox once, reinstalled it and it ran. I had a problem so I uninstalled/reinstalled it again. Now it will not run. I get an error message saying that firefox is running and you can only run one at a time. I have uninstalled multiple times and can't figure out what is running. The is only one Firefox installed and it is not open. What does this mean and how do I fix it?

    If you use ZoneAlarm Extreme Security then try to disable Virtualization.
    *http://kb.mozillazine.org/Browser_will_not_start_up#XULRunner_error_after_an_update
    See also:
    *[[/questions/880050]]

  • I'm getting error messages when I download updates for lightroom and flash for the mac. can't figure out how to trouble shoot.

    I'm getting error messages when I download updates for lightroom and flash for the mac. can't figure out how to trouble shoot.

    It sounds as if your browser and some of your apps are not color-managed.  This is pretty typical.  Even IE9 is only partially color-managed.
    You can expect color-managed and non-color-managed applications to show you different things with the same images.  How different will depend upon how different your monitor color profile is from the image's color profile.
    For web publication and most general use, experts usually advise saving images with the sRGB profile.  If such images, saved through the Save for Web & Devices function, look different to you than you expect, it may be that your input images have previously been saved in another color space.
    You should really try to get your head around color-management by reading more on it.  It can seem baffling and it's difficult to understand without some background.  A quick web search turns up many overviews.  Beware, though, even people writing articles sometimes don't fully understand it.
    -Noel

  • I tried to download a tv series and only 2 of the episode actually downloaded (the others have an error message).  I can't figure out how to try to download them again.  Thanks for any help

    I tried to download a tv series and only 2 of the episode actually downloaded (the others have an error message).  I can't figure out how to try to download them again.  Thanks for any help

    Open the Disk Utility in the /Applications/Utilities/ folder, click on it in the sidebar, select the Erase tab, and reformat it.
    (103900)

  • Error message I can't figure out

    Can anyone help with this problem: Whenever I try to save a video I created I get a file error:illegal name message. I can not figure out where the problem is or how to fix it. This occurs near the end of the saving process.
    file name is final ceremony and reception 2-26-10

    OSX has certain character strokes that are not to be used in file names. It's most likely the cause.
    You can Google a full list.
    Al

  • Can't figure out how to stop my MBP from opening programs at startup, namely word and messages

    Recenty my MBPro has started opening MS Word and Messages at startup and I can't figure out how to stop it?  I've tried selecting and de-selcting the startup option from the dock but this doesn't help.  Does anyone have any suggestions?

    System Preferences has a setting for this.
    In the Users & Groups section you will fine a "Login Items" header.  This is a list of all the programs that will open automatically when you log in.  You can select any program and click the [--] button below that window to stop the program from opening automatically.

  • Am getting message from MacPro that my start up disc is full - but I can't find it and can't figure out what to do to help situation. I've been making a number of imovies, which generates junk files. help?

    I am getting message from MacPro that my start up disc is full - but I can't find this "start up disc" and can't figure out what to do to help situation. I've been making a number of imovies, which generates junk files and material that I should toss in the trash, but it is not clear to me  what items I can toss and which items I can't toss. Can you help? Using the imovie "help" support the system showed me under the menu item "go" where the "start up disc" should be - but that wasn't actually available on my menu!  Thanks for your help!

    Disk Utility 
    Get Info on the icon on Desktop
    Try to move this to the MacBook Pro forum
    Your boot drive should be 30% free to really perform properly. 10% minimum
    Backup, clone, use TimeMachine, use another drive for your projects and movies, replace and upgrade the internal drive even.

  • I just upgraded to mountain lion and I can't figure out how to use messages...  it wants me to use AIM or something like it, but I can't change the user...

    I just upgraded to mountain lion and I can't figure out how to use messages...  it wants me to use AIM or something like it, but I can't change the user... How do I do this??

    See this Thread

  • Can someone please tell me a simple but effective method for burning a slideshow to DVD? Now that the connection between iPhoto and iDVD no longer exists, I can't figure out a way to get there with an acceptable quality result.

    Can someone please tell me a simple but effective method for burning a slideshow to DVD? Now that the connection between iPhoto and iDVD no longer exists, I can't figure out a way to get there with an acceptable quality result.

    Export the slideshow out of iPhoto as a QT movie file via the Export button in the lower toolbar.  Select Size = Medium or Large.
    Open iDVD, select a theme and drag the exported QT movie file into the open iDVD window being careful to avoid any drop zones.
    Follow this workflow to help assure the best qualty video DVD:
    Once you have the project as you want it save it as a disk image via the File ➙ Save as Disk Image  menu option. This will separate the encoding process from the burn process. 
    To check the encoding mount the disk image, launch DVD Player and play it.  If it plays OK with DVD Player the encoding is good.
    Then burn to disk with Disk Utility or Toast at the slowest speed available (2x-4x) to assure the best burn quality.  Always use top quality media:  Verbatim, Maxell or Taiyo Yuden DVD-R are the most recommended in these forums.
    If iDVD was not preinstalled on your Mac you'll have to obtain it by purchasing a copy of the iLife 09 disk from a 3rd party retailier like Amazon.com: ilife 09: Software or eBay.com.  Why, because iDVD (and iWeb) was discontinued by Apple over a year ago. 
    Why iLife 09 instead of 11?
    If you have to purchase an iLife disc in order to obtain the iDVD application remember that the iLife 11 disc only provides  themes from iDVD 5-7.  The Software Update no longer installs the earlier themes when starting from the iLIfe 11 disk nor do any of the iDVD 7 updaters available from the Apple Downloads website contain them. 
    Currently the only sure fire way to get all themes is to start with the iLife 09 disc:
    This shows the iDVD contents in the iLife 09 disc via Pacifist:
    You then can upgrade from iDVD 7.0.3 to iDVD 7.1.2 via the updaters at the Apple Downloads webpage.
    OT

  • I recently upgraded to iOS 8. Looks like the pics I had in my messages are no longer appearing as pictures, rather they are appearing as JPEG files (not broken jpegs). I need to get these pics. Can't figure out how to do it. I'm on an iPhone 5C.

    I recently upgraded to iOS 8. Looks like the pics I had in my messages are no longer appearing as pictures, rather they are appearing as JPEG files (not broken jpegs). I need to get these pics. Can't figure out how to do it. I'm on an iPhone 5C.
    I've tried resetting my phone, looking for the pics in the new 'deleted' folder. I tried forwarding the jpegs to sees if they'll appear in a new message (but turnout the phone won't let me forward these pics). Apple is trying to say it's the 30 day reason, but I know that is not the problem. ALl of my pics older than 30 days were viewable. It is the upgrade that screwed this up. Help! Important pics!

    Try this to learn about using keys:
    http://www.apple.com/support/macbasics/
    You can also use your PC mouse.
    As for iPhoto, it sounds like you were trying to move files around in the library. That is a bib no-no in Aperture or iPhoto.

  • Hi, I can't figure out why I can't render on my timeline. I highlight the segment hit "Apple-R" and it gives me a weird message about "conforming HDV video...." and the bar goes as far as 60-66% and holds there forever. It never renders even partially.

    Hi, I can't figure out why I can't render on my timeline. I highlight the segment hit "Apple-R" and it gives me a weird message about "conforming HDV video...." and the bar goes as far as 60-66% and holds there forever. It never renders even partially.

    Yes, I know. I have been working with HDV for some time. I am wondering why it doesn't render when it needs to.. the red and bright-green lines are above, and I've set the render settings such that ANYTHING I highlight and hit apple-R will render. But its not rendering at all.

Maybe you are looking for