Having major problems with arrays, please help

Hi,
I'm writing a program to simulate a juke box using an array of strings to hold each track that is input. when the program starts, the user is asked the maximum number of songs to store, and this is passed to the constructor of the PlayList method, which sets up on array of Strings called queue with the total given.]
I have four options, one to add a song, one to play the first song in the queue and then remove it from the queue. One to display all the songs in playlist, and one to quit. NB it doesn't "play" the song it just displays a message saying "now playing - song name".
It all works UNTIL i choose option 2 (play first song and then remove it from the queue). This seems to work, but then when I choose to display all the songs, its not removed the right one, and now there's two of the same. I've been trying for hours with this, and it's really annoying me. Here's the PlayList class
public class PlayList
    //declare attributes
    private String [] queue;
    private int total;
    //declare constructor
    public PlayList(int numsongs)
        queue = new String [numsongs];
        total = 0;
    public boolean addToQueue(String track)
        if (!isFull())
            queue[total] = track;
            total++;
            return true;
        else
            return false;
    public boolean removeFromQueue()
        if (isEmpty())
            return false;
        else
            int i;
            //remove first item off queue -- queue[0]
            for (i=1; i <= total-1; i++)
                //rename the others
                queue[i] = queue[i-1];
            total--;
            return true;
    public boolean isEmpty()
        if (total == 0) return true;
        else return false;      
    public boolean isFull()
        if (total == queue.length)
            return true;
        else
            return false;
    public String getItem(int item)
        return queue[item-1];
    public int getTotal()
        return (total);
    And here's the code from the main class which is executed.
public class JukeBox
    public static void main(String[] args)
        //delcare variables
        int choice;
        PlayList playlist;
        int maxnum;
        String song;
        System.out.println("*** Jukebox simulator ***" + "\n");
        System.out.print("Maximum number of songs in playlist: ");
        maxnum = EasyIn.getInt();
        playlist = new PlayList(maxnum);
        do
            System.out.println("\n" + "[1] Add song to playlist");
            System.out.println("[2] Play first song in playlist");
            System.out.println("[3] Display list of songs in playlist");
            System.out.println("[4] Quit" + "\n");
            System.out.print("Enter choice  [1-4]: ");
            choice = EasyIn.getInt();
        //if statements for each case
        if (choice == 1)
            if (playlist.isFull())
                System.out.println("*** Cannot add song, playlist is full ***");               
            else
            System.out.print("Enter artist and song name - ");
            song = new String(EasyIn.getString());
            playlist.addToQueue(song);
            System.out.println("\n" + "*** Song added to playlist ***");
            System.out.println(song + "\n");
        if (choice == 2) //display first song in queue, and then remove it from the queue
            if (playlist.isEmpty())
                System.out.println("*** No songs in playlist ***");
            else
                System.out.println("*** Now playing: ***");
                System.out.println(playlist.getItem(1));
                playlist.removeFromQueue();
        if (choice ==3)
            if (playlist.isEmpty())
                System.out.println("*** No songs in playlist ***" + "\n");
                return;
                System.out.println("*** Songs currently in playlist ***");
                for (int i = 1; i <= playlist.getTotal(); i++)
                    System.out.println(playlist.getItem(i));
        if (choice == 4)
            System.out.println("*** Thank you for using the juke box simulator ***");
        while (choice != 4);
}Any ideas?

Hi,
I just realised that before u posyed (honest, I did hehe), and now my code its like this
public boolean removeFromQueue()
        int i;
        if (isEmpty())
            return false;
        else
            for (i=1; i <= total; i++)
                queue[i-1] = queue[i-];
            total--;
            return true;
    }But now I get IndexOutOfBoundsException :s

Similar Messages

  • I have adobe premiere elements 10 and I am having some problems with it please help

    So here are the problems I'm having with Adobe Premiere Elements 10:
    1. Transitions will not load. The word loading pops up and it won't come up.
    2. The videos won't play smoothly. When I press play it skipps in a way it won't play smooth which makes it really hard to edit.
    3. Keeps closing out on me. It will have a thing that pops up that says "Adobe premiere elements has stopped working and closes out of the program. It does it constantly.
    Please help me I don't know what is wrong with it.

    The first two issues sound like a video driver problem.
    What is the make/model of your video card/chip?
    What is the installed video driver number and date?
    For the last issue, it could be many things, including the video driver. I'd look over this ARTICLE, and if there is nothing in the first part, then move on to tuning up the OS an computer in the second part. That would probably be a good time to post the full specs. of your computer, and also both your Project and Source footage. Finally, part three covers many troubleshooting tips, and furnishes many links.
    Good luck,
    Hunt

  • I am having major problems with my trackpad on my macbook pro.  I can no longer press down on the bottom left and right corners for it to click and follow my command.  Please can anyone help?

    I am having major problems with my track pad on my macbook pro.  Even though my settings haven't changed...my trackpad is no longer responding as it did before.  The left hand corner no longer clicks when I press it and my personal commands which I set up in preferences no longer seem to be workin.  Please help!

    Some websites have an internal mute or volume setting. If that's not the issue, see below.
    From the Safari menu bar, select
              Safari ▹ Preferences... ▹ Privacy ▹ Remove All Website Data...
    and confirm. Close the window. Then select
               ▹ System Preferences… ▹ Flash Player ▹ Advanced ▹ Delete All...
    In the sheet that opens, check the box marked
              Delete All Site Data and Settings
    then click Delete Data. Close the preference pane.

  • Anyone else having major problems with Safari 5.1 on Snow Leopard?

    is anyone else having major problems with Safari 5.1 on Snow Leopard?
    - address bar and search box are not resizing with browser window. the address bar and seach box set their size to the window when Safari is launched and remain that size.
    - anytime i try to customize toolbar items disappear and i have to restart Safari to get them to appear.
    - some 3rd party icons just remove themselves from the toolbar after a period of time
    - when i drag a page from the tab bar to create it's own browser window the window disappears but is listed in the windows menu bar. when i select that window from the menu bar the window appears but i can't click on anything.
    I've repaired permissions numerous times, reinstalled safari numerous times and restarted my machine numerous times and the issues all remain. i've never had any issues with Safari until now and 5.1 is looking like a huge mess.
    besides the bugs above, has anyone had any luck with 1password working with Safari 5.1?

    ok, i narrowed most of my issues down to Web Snapper and Videobox by TastyApps. Removed both of those and now everything works better.
    I went out to lunch and came back an hour later and magically ALL of my previous toolbar icons that were added to my previous version of Safari appeared. Very strange.
    as for 1password, it wasn't working at all before when i posted. everytime i tried installing the extension via the app my, Safari would open a window and hang (never load). I just tried it again and it seems to now be working.

  • I am having major problems with Firefox. About 3 weeks ago I started experiencing the display only when on Firefox for all web site, that the display would be shifted right about half a screen. It only happens on Firefox and happens for all web sites.

    I am having major problems with Firefox. About 3 weeks ago I started experiencing the display only when on Firefox for all web site, that the display would be shifted right about half a screen. It only happens on Firefox and happens for all web sites.

    This issue can be caused by the Babylon Toolbar 1.1.8 extension
    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.com/kb/Safe+Mode
    *https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes

  • I am having a problem with ICLOUD. Help!

    I am having a problem with my icloud. So here is the story. I had iphone 4. My contacts were backed. Someone stole my iphone. I got a new iphone 4s. My contacts did not sync from my previous iphone 4. so someone told me to restore to iphone 4 backup. I did. And wow! i got all my contacts back. I want all my contacts to be saved. And i don't want to lose them, it took me a while to build this list properly. With email and number and address.
    Here is what i tried so far, i backed up from itunes to computer, then backup to icloud, then I did from my phone, i turned the contact switch on also, and the swtich on to back up to icloud. When I go to icloud.com. it's not there. If anyone can help me with this issue I would appreciate it. because i have a lot of contacts, and I need to save them in a way, I won't ever lose them.

    You would need to backup into icloud again also if you have enough room to backup. If not purchase more icloud backup or backup to itunes. Sync your contacts back to your email where they will always be.

  • Having major problems with iPod Shuffle, please help!!

    Okay, I have a 2nd iPod shuffle and it just will not connect to my computer. I've used to adaptor that came with it and it worked once but I only added a couple of songs and I want to add more now but I can't! The light blinks orange 3-4 times and nothing happens on my PC. I borrowed my friends charger and absoloutly nothing happens with his. But I can still charge it because I have a USB wall charger which I can connect my charger to and it charges perfectly with that. So, naturally I thought there was something wrong with my PC/USB sockets. So, I tried it on my friends computer - same results as with mine. I can't use the reset utility though because I'm running Windows 7 on 64 bit and there's no download out there for that. Please help somebody - I really want to add more songs to my iPod, and this is becoming really frustrating. :/

    Okay, so maybe I wasn't clear enough when I said nothing happens on my PC? Well, literally nothing at all happens on my PC, it doesn't show up in My Computer or iTunes.

  • I'm having MAJOR problems with my iPod please help!!!!!

    Well, i have a 30 GB iPod video and it's about a year old. My iPod has frozen before but i usually just wait till the batteries die and charge it again but this time i casn't charge it my computer doesn't even read it and neither can itunes! somebody please help!

    . Try to put the iPod into Disk Mode if it fails to appear on the desktop
    http://docs.info.apple.com/article.html?artnum=93651
    Then restore your iPod to factory settings.
    http://docs.info.apple.com/article.html?artnum=60983

  • Various Problems With N95 - Please Help!!

    Ok well I opened a new contract on the 2nd of June with Orange and got a Nokia N95.
    Since the 2nd of June, I have had a total of 5 different N95's because of all the problems I am having. Got the current one last sunday and these are the problems so far:-
    - Phone randomly turns off (only once or twice so far)
    - Take about 2 hours to send a text, or is says "unable to send text message")
    - My reception is full, then will automaticaly drop to zero bars
    - People try and ring me, it goes straight to my answer phone and then i get a text saying I have a missed call (happened twice)
    Does anyone have any suggestions as to what I can do? This is driving me crazy.
    I love the phone, but this is not what should be happening.
    Like I said, this is now the fifth Nokia N95 I have had!
    I'm not sure how I check which software I have, so if someone tells me where to look I will be able to tell you.
    Please help!
    Many thanks, Holly x

    Be patient calm down
    Like I said the updates are on MODEL NUMBER
    the Orange version will be a few weeks behind because they test every thing them selves They are paranoid about phones that run on their network In the good old days they had to aprove every phone on their network so if you had a sim free you had to ask them if you could use it Thay dont do that now but all the phones they sell for their network are supposed to be full tested to be working OK Thats why not all models and phones are not on Orange
    They dont seem so much bothered if the phone crashes but they dont want you to crash the network lol
    As soon as they have fully tested V12 it will be released for the updtae Orange have one or two mods to the basic software IE there own themes, screen savers, orange world, and the omission of voip. They also have ALS (line 2)
    I use Orange but since the early probs I manged to get the unbranded sim free for Orange. On my one ALS (line2 2 lines 2 numbers 1 sim card Business and personal) is working OK so there are only the screen savers and Orange world they need to test fully All I can say is just wait
    A service centre may get the update earlier or try looking in Orange shops at their current stock press *#0000# on their newer stock to see if they get V12 then the service centre will have it for repairing those ones and it will soon be on the update site
    Nokia user / modder since Nokia Orange and Mobira user too before that

  • 6 weeks of problems with Ical- Please help

    For 6 weeks now I have been having problem after problem with Mobileme, Ical, and contacts synchronizing with my imac, laptop, and iphone after at least two years of no problems. I have been to the Apple store over 6 times and have had 3-4 hour long chats with Apple technicians and have had 3-4 emails with an advanced technicians. Everyone is quite nice and really seems to be trying to help fix the problems, sadly, this situation is still not resolved. My confidence that Apple knows what is going wrong or knows how to fix it have really taken a hit and I'd ask anyone who has the savvy to help me with this to PLEASE help me out here.
    The current situation is:
    Cannot log into Mobile me to get my calenders - Apple can't either. We both can log in to idisc, contacts, etc. though all are duplicated 2-3 times.
    If you try to sync with the phone, including after re-setting what appears to be a correct calender on to mobileme first, the phone calender will appear completely blank.
    Manual sync with the USB works. However, even if you totally wipe the whole iphone and then install just what is on the computer, some appointments are missing on the iphone! I have verified that there are just the correct calenders listed on the imac so the appointments missing on the iphone are part of the calender listed on the imac. (When I wiped the iphone and choose automatic sync, numerous calenders were seen. Part of the reason there were so many calenders at all was part of the problem I initially had and the result of apple technicians trying to fix it!)
    I now have. mac and .me mail accounts listed on my iphone despite the fact that the .mac account had been replaced with the .me account of the same name by at least two technicians at the Apple Store and Ichat.
    I need help immediately and cannot either wait for Apple or have much confidence they know what is going on.

    Yes this has been a nightmare for me and started with duplicate dates, followed by duplicate calenders, and 2 years of lost data, followed by duplicate contacts. I am clear that some of this is the direct result of how I was advised to fix my problems.
    I have seen 2-3 people report problems around this same time frame. The techs at apple have denied a system problem from that time but like you it is odd that a system that seemed to work perfectly went wrong at that for at least the two of us and three other people that I know of. I have only reviewed a portion of the posts.
    My conclusion is that Apple does not provide adequate warnings or instructions regarding how to interface with ical, syncing with mobile me, or what needs to be backed up even though one is putting one's data on the cloud and 1-3 other devices. Further, the protocols Apple techs use to deal with these kinds of issues seem to be leading to more problems.
    I have saved a comprehensive log of my chats with Apple and my interactions with the "genius bar" at Apple that I'd be willing to post here or share via email that shows how this process evolved and what choices were made to remedy the situation.
    To briefly illustrate my point consider these things I've learned in the process:
    1). Apple does not design all of it's key software with auto back-up like they do with Final Cut, or Intuit does with "Quicken". Apple told me that they expect someone would use the "export" or " back-up iCal" from the file menu. They also said that I had the option of using the utility "back-up" or "Time Machine" if I wanted "auto" back up.
    I must admit to feeling pretty stupid about all of this until I remembered that Apple emphasized the automatics of "the cloud" as next step after the "Palm". Even the "Missing Manual" bills it that way. So... I just plugged and played as they say and did not actively make sure that I needed to back Ical up! I also thought that since my iphone backs everything up when you synchronize that everything would be saved. Anyone have any ideas how to get your calender off the iphone back up if the cloud and your computer files are wrong? I've been told that you cannot. I am also a bit unclear about what files need to be backed up if I want to use Time machine or back up to protect my Calenders? Again can't they just say so?
    2). It has come to my attention after talking to 4 different Apple reps that the Itunes interface is a bit unclear. I was told that IF YOU USE MOBILE ME, YOU CANNOT HAVE THE SYNC BOXEXS CHECKED FOR ICAL, MAIL,CONTACTS, OR YOU WILL HAVE DUPLICATE ENTRIES. I am not sure if this is true or what started the whole problem. It does kind of make sense given there are Mobile me options in the system prefs for what to do with them as well.
    Apple should have told me the above after they tried to resolve this duplicate problem last December by resetting my mobile me with my laptop, deleting and reinstalling my account on my phone and syncing with Mobile me. If they had, I would not have had the duplicate entries and as well as accounts a few weeks later. I also would not have tried using the same method to re-fix the problem leading to all my calenders prior to mid December being destroyed!
    Why wasn't that warning in the itunes sync dialogue box to begin with?

  • WRT350N - How to tell if it's V1 or V2? Having major problems with it

    I have a WRT350N that I purchased about a year or so ago and I'm trying to figure out if it's V1 or V2. Seems like tons of people are having problems with this series. I was having problems with the wireless connection going dead constantly (5+ times a day). Since I work from home this was obviously not acceptable. I upgraded the firmware after talking with Linksys tech support. After that, the problem got much worse. Now the wireless connection goes down as well the router loses it's internet connection. I finally removed it from my home network and put my old reliable D-Link 614 back in place. It's been working fine and actually has way better range. Before I throw this WRT350 in the trash I would like to see if mine is V1/V2 and if there is anything I can do with it.
    Thanks!
    Matt

    To find out the router's version number look at the bottom of the router, it should say Model Number : WRT350N, right next to the model number if it says V2 then it is version 2 else it is V1...I assume it should be V1...
    If you have intermittent connection, you should download and upgrade your router's firmware from here
    Follow these steps to upgrade the firmware on the device : -
    Open an Internet Explorer browser page on a computer hard wired to the router...
    In the address bar type - 192.168.1.1...Leave the Username blank & in Password use admin in lower case...
    Click on the 'Administration' tab- Then click on the 'Firmware Upgrade' sub tab- Here click on 'Browse' and browse the .bin firmware file and click on "Upgrade"...
    Wait for few seconds until it shows that "Upgrade is successful"  After the firmware upgrade, click on "Reboot" and you will be returned back to the same page OR it will say "Page cannot be displayed".
    Now reset your router :
    Press and hold the reset button for 30 seconds...Release the reset button...Unplug the power cable from your router, wait for 30 seconds and re-connect the power cable...Now re-configure your router...
    For Wireless Settings, please do the following : -
    Click on the Wireless tab,
    - Wireless Network mode should be mixed...
    - Provide a unique name in the Wireless Network Name (SSID) box in order to differentiate your network from your neighbours network...
    - Set the Radio Band to Standard-20MHz and change the Standard channel to 11-2.462GHz...Wireless SSID broadcast should be Enabled and then click on Save Settings...
    Please make a note of Wireless Network Name (SSID) as this is the Network Identifier...
    For Wireless Security : -
    Click on the Sub tab under Wireless > Wireless Security...
    Change the Wireless security mode to WEP, Encryption should be 64 bit.Leave the passphrase blank, don't type in anything...
    Under WEP Key 1 type in any 10 numbers please(numbers only and no letters eg: your 10 digit phone number) and click on save settings...
    Please make a note of WEP Key 1 as this is the Security Key for the Wireless Network...
    Click on Advanced Wireless Settings
    Change the Beacon Interval to 75 >>Change the Fragmentation Threshold to 2304, Change the RTS Threshold to 2304 >>Click on "Save Settings"...
    Now see if you can locate your Wireless Network and attempt to connect...

  • I have a serious problem with GridBagLayout please help

    I have an working code of an Swing application that has used gridbaglayout it works very well in desktop pc on 2000/xp with 800 x 600 screen resolution but the problem is when i change the screen resolution to higher say at 1152 x 864 resolution then the same code all the components are left align and not properly distributed even though i have GridbagConstraints.BOTH for the fill variable of the Gridbaglayout. Also i am facing similar problem when i run the code on the laptop.
    Please help me and can anyone tell me what to do in case i want the layout to show in the same manner for higher resolution as it is showing for lower resolution.

    you may have to setPreferredSize to a calulation from the screen resolution, if there is 1 thing that is 1 pixel too big for it, i find it stuffs the entire container
    Drogo

  • Lenovo S205 & Windows 7 64bit. Problems with graphics, please help

    Hi, 
    I recently bought a Lenovo s205:
    AMD E-350
    It came with 1GB but I upgraded it to 4Gb RAM (1333 running at 1066)
    Windows 7 64 Ultimate.
    I have tried also Windows 7 32 (Professional, ultimate) and all versions give me the same problem, I will explain here:
    I have tried in AHCI mode and IDE mode from the bios and done fresh installs of Windows. Still the same.
    After installing all the drivers, I get randomly in different programs "black" or sometimes "white" menus. Whenever I set the cursor on the menu (White or black part), the letters start showing up.
    On Firefox for example, it happened where you write the address (Ex: www..) And when searching images too.
    I have tried the original drivers that the Lenovo's website has for the S205 and the latest from Ati/AMD and nothing solves the problem.
    What can this be? Faulty ram? Faulty OS? Problem with the graphic card drivers?
    Please help, it is so frustrating. 
    Thank you so much. 

    Thank you very much for your help. 
    I will try capturing some screenshots if that helps.
    I can discard the problem with the ram at the moment. I have tried a new set of ram (two 2gb modules = 4gb in total). The problem persists, even when they are tried individually. I also tried the original ram module the Lenovo came with (1module of 1gb), alone. Problem persists too.
    However, I do not have a problem trying the VGA output. Will this help too? As I do not have any screen with HDMI at the moment. 
    What I will do too, is to try a Windows 7 from another disc, a Home version 32 bit. I hope this can get the problem fixed.
    The main issue is that I bought this computer from Germany (From a store on eBay) and came with DOS. I will have to return it to the seller, I assume, if the rest fails to show any improvements.
    Thank you for your reply and any more suggestions are welcome.

  • Another person who has a problem with Flash - Please Help!!

    I have a Dell Dimension 4700 Intel (R) Pentium (R) - 4 CPU   2.80 GHz    2.79 GHz    504 MB of RAM
    For a few years now I would have to restore the computer to an earlier time after an update was done in order to view youtube, etc.  It seemed that when my computer did an automatic update it would mess up the flash player.
    My husband just recently did another update and now the flash isn't working and the computer won't restore anymore.
    I keep getting the following messages:  adobe flash player active x set up failed to install 19166
    program error:  failed to register      status installation complete
    I have uninstalled and installed the flash several times
    everytime i go to install flash it says:  Adobe Flash Player 10:  This application has been downloaded before.  Reload?
    Then I get:  Your security settings do not allow websites to use ActiveX controls installed on your computer.
    I don't want to take this somewhere because I have a feeling that will just wipe the computer clean and I have a feeling it is something stupid that I'm not doing.
    Please Help.

    OK...Check, check...did all that. I am cutting and pasting a segment from the flash troubleshooting page because its exactly what is happening to me. There were no responses to help this person.
    "I've tried installing flash player 9 but am not able to do so. It will begin installing but when it gets to 'items remaining: 4' the progress bar continues to move and underneath says searching but nothing happens. I tried leaving it on all night but same thing when I came back in the morning. When I close the installer it then says 'stopping now may result in an incomplete set of software' Also, when I tried uninstalling previous versions, the uninstaller does nothing. It says 'items uninstalled: 0' and 'processing', but same thing, the thing spins but nothing happens. i tried the other steps given to see if that helped but nothing seems to work."
    Here is the page...
    http://sdc.shockwave.com/cfusion/webforums/forum/messageview.cfm?forumid=44&cati d=184&threadid=1267248&enterthread=y#4577694
    I tried some of the suggestions above the last two posts. But it looks like my problem is the same as those.
    I even tried to post on there but from what I see it looks like I have to have flash to do it...I get the page with the blue lego brick.
    I'm pulling my hair out. I didn't realize how much of the internet ran on flash.

  • Problems with iTunes, please help

    Hey:
    This is my problem... I just bought and iPod Nano and installed the iTunes software, and at the beginning it was working perfect, then my computer started doing weird stuff every time iTunes was on and it even got me the blue screen of death (I have a PC and my OS is Windows Vista Ultimate) so I had to restart my computer.
    After doing it, I cant open iTunes anymore. Each time I do I get first a message that says "iTunes has stopped working. Windows is looking for a solution to the problem.", after that I get a message that says "iTunes has stopped working. A problem caused the program to stop working correctly. Windows will close the program and notify you if any solution is available."
    Then I get a windows that says this:
    "Download updates for iTunes
    This problem was caused by iTunes. iTunes was created by Apple Inc..
    Solution
    A newer version of iTunes is available for download that will address this problem. Apple Inc. recommends updating to the latest version of iTunes to take advantage of security and stability improvements.
    Go to the Apple Inc. website and install the latest version of iTunes:
    Apple Inc."
    But Im already running the last version and Ive even desinstalled and installed the software twice. I dont know what else to do and without iTunes, my iPod Nano is worth nothing.
    These r the details of the problem Im getting:
    Problem signature
    Problem Event Name: APPCRASH
    Application Name: iTunes.exe
    Application Version: 7.5.0.20
    Application Timestamp: 472bcf3d
    Fault Module Name: QuickTime.qts
    Fault Module Version: 7.3.0.80
    Fault Module Timestamp: 473be8d5
    Exception Code: c0000005
    Exception Offset: 00055e30
    OS Version: 6.0.6000.2.0.0.256.1
    Locale ID: 1033
    Additional Information 1: 720c
    Additional Information 2: 87abfdde4e44868a2d32f6948e899598
    Additional Information 3: 9842
    Additional Information 4: 44f9b0c24d5b0e3b47d19db09c196961
    Extra information about the problem
    Bucket ID: 582161050
    So, can anybody help me please??????
    TIA
    Antonio R.

    What happens if you try to start Quicktime? Does it work normally? I am guessing that it doesn't, but describe what happens with any error message in full.
    I am jumping the gun with the troubleshooting sequence here, but ...
    Have installed any of the following - ACE & K-Lite mega codecs package, QT alternative, Storm codec, also WinAVI video converter. These are know to cause problems with QUicktime and need to be uninstalled.
    ANyway I suggest you do a complete removal of iTunes and associated programs followed by a phased install of QUicktime then iTunes.
    Download a new copy of iTunes and the stand alone Quicktime installer:
    http://www.apple.com/quicktime/download/win.html
    http://www.apple.com/itunes/download/
    Use the follwing method to remove the programs:
    XP
    http://docs.info.apple.com/article.html?artnum=93698
    Vista
    http://docs.info.apple.com/article.html?artnum=305409
    Install Quicktime and check if it works, then install iTunes.
    Does it work now?
    This has been based on the assumption that QUicktime doesn't work, if it is OK here is an iTunes troubleshooting link:
    XP
    http://docs.info.apple.com/article.html?artnum=302856
    Vista version
    http://docs.info.apple.com/article.html?artnum=305491

Maybe you are looking for