Please help/Array sorting

Please , people help.. I am novice in the Java programming and working on the following problem right now.: Using a single-subscripted array need an applet that inputs 5 numbers, each of which betwee 10 and 100, inclusive. As each number is read,display it only if it is not a duplicate of a number already read. Have to provide for the "worst case" in which all 5 numbers are different . Need a smallest possible array to solve this problem.. Please help. Sitting here and can not do anything abt it..Need code..Sincerely A.

Have you attempted to do anything at all? Why should
we help you pass a class so that you can be dead
weight on our development projects later?this is genius! amen.

Similar Messages

  • Well, i was on my laptop now and all of a sudden a pop up message appeared and said "your download is complete" so i went to go check it out and it was 'MacProtector'. i cant delete it and it keeps opening unwanted web pages, please help me sort this out?

    Well, i was on my laptop now and all of a sudden a pop up message appeared and said "your download is complete" so i went to go check it out and it was 'MacProtector'. i cant delete it and it keeps opening unwanted web pages, please help me sort this out someone?

    Refer to:  http://cantalktech.com/2011/05/08/mac-protector/.

  • Corrupted iPod- Please help me sort it out!

    Hey everybody,
    First of all thanks alot for trying to help me sort out my iPod; it's truly appreciated.
    Basically i have had a 30GB 5th Gen iPod Video for about 18 months. It seemed alright but recently it has become corrupted. The iPod seems to work, but when i plug it into iTunes i get this message:
    "Itunes has detected an iPod that appears to be corrupted".
    I have restored the iPod to factory settings as suggested, and retried connecting it to my computer but i cannot get the iPod to sync with iTunes.
    Does anyone know what i can do to fix it? I don't think i dropped it very hard but i may have dropped my iPod after a night out recently...
    THANKS LOADS!!

    Hi oli_t,
    If a second/third attempt at restoring your iPod does not work to fix that "corrupted" message you are getting in iTunes, then you may want to try running disk error checking (sometimes just called "chkdsk") on your iPod.
    For instructions and info about that, see this MS document:
    How to perform disk error checking in Windows XP
    -Kylene

  • Please help - Jtable sorting columns

    Hi friends...
    I have a JTable whith many different kinds of columns... When I click on a column, it sorts all the table according to the clicked column. How can I make that only the order of THAT column to be reversed (ascending/descending)?Visually, it should only sort the table righthand of the clicked column...
    Any ideas?
    ThanX for your help...

    Hi
    Please find some handy information on JTable and other swing examples.
    http://www2.gol.com/users/tame/swing/examples/SwingExamples.html
    Hope this helps
    Swaraj

  • IPhoto - Please Help Problem Sorting Photos

    Hi everyone,
    I imported pictures into iphoto that had been taken with 2 different cameras, but all have similar dates within a certain time span. I imported my own pictures on the 6. October and the other ones on the 8th October. Although the pictures have both been taken in September, iPhoto puts my photos in the October section and uses this as "date taken" and the other photos are sorted correctly.
    The Background is that I would like to do a slide show and it is very complicated to switch between the pictures and they are around 1000 in number.
    By the way, does anyone know an easy way to adopt the Ken Burns effect of iphoto and then edit text and a audio track in imovie? I was used to Magix Video, which is really simple in handling and now on the mac I think imovie takes such a long time for rendering.
    Thank you for your answers.
    Macbook Mac OS X (10.4.8)
    Macbook 2 Ghz 1,25 GB Ram 60 GB HD   Mac OS X (10.4.7)  

    Yes, you can take advantage of the Ken Burns effect for a slideshow in iMovie. Just export the slideshow you made in iPhoto, and then it will be a Quicktime movie that you can import into iMovie to add audio and text to it.
    If I understand correctly, your photos show a date in October instead of September. If you select all of the photos whose date you want to change, you can apply the date change to all of them at once. You can do this in the "information" window that toggles in the lower left corner of iPhoto.
    Please let me know if this helps or if you need further assistance.

  • Please help array and tables

    value for my parameterp_yymm :=(1001,1002,:,:,1005,:,:,1008,,:,:,:,:,1101,1102) colon rep as non selected value
    i need to get position of all values like
    1001 -1
    1002 -2
    1102-14
    then my ouput should like this (yynnynnynnnnyy)
    create or replace
    FUNCTION FN_SUB_BEHAVIOUR(P_YYMM IN VARCHAR2)
    RETURN VARCHAR2
    IS
    TYPE TYP_ARR_TEST IS TABLE OF VARCHAR2(1000) INDEX BY VARCHAR2(1000);
    TYPE ELIMINATE_TYP IS TABLE OF VARCHAR2(15);
    V_ELIMINATE ELIMINATE_TYP;
    ARR_LIST APEX_APPLICATION_GLOBAL.VC_ARR2;
    V_LENGTH VARCHAR2(10000);
    LOOP_VALUE VARCHAR2(10000):=1000;
    I VARCHAR2(10000);
    V_LIKE VARCHAR2(10000);
    V_INDX NUMBER(10); v number(5);
    BEGIN
    --ARR_LIST := APEX_UTIL.STRING_TO_TABLE(p_YYMM,',');
    ARR_LIST := APEX_UTIL.STRING_TO_TABLE(P_YYMM,',');
    for i in 1..ARR_LIST.count loop
    if i=1 then
    v_LIKE:= ''''||ARR_LIST(i)||'''';
    else
    V_LIKE:=','||v_LIKE||','||''''||','||ARR_LIST(i)||'''';
    end if;
    V_ELIMINATE :=ELIMINATE_TYP(V_LIKE);
    FOR I IN V_ELIMINATE.FIRST..V_ELIMINATE.LAST
    LOOP
    v:=i;
    -- IF V_ELIMINATE(I)=';' THEN :='0';
    -- ELSE V_ELIMINATE(I):='1'; END IF;
    --END LOOP;
    RETURN v;
    end loop;
    END LOOP;
    END;
    my ouput should like this (yynnynnynnnnyy)
    Edited by: raj on Mar 23, 2011 2:55 AM
    Edited by: raj on Mar 23, 2011 3:20 AM

    don't you just want to do something like this then?
    ARR_LIST := APEX_UTIL.STRING_TO_TABLE(P_YYMM,',');
    for i in 1..ARR_LIST.count loop
      if arr_list(i) in (';', ':', 'o') then v_result :='N';
      else v_result :='Y';
      end if;
      v_outstring := v_outstring || v_result;
    end loop;
    return v_outstring;

  • Please help me sort this with xmlAgg()

    Hi gurus,
    I need to have the order by clause with the xmlAgg() function, but I get errors (missing parenthesis or missing keyword). Is this not allowed or is there a way around it?
    Thank you.
    Ben

    Hi Max,
    I tried what you have here by itself and it works perferctly,
    with t as
    (select b.booking_no from MyBookings b where trunc(b.date_booked) = trunc(sysdate)
    order by b.booking_no)
    select xmlelement("TodaysBookings", (select xmlAgg(xmlelement("BookingNo", booking_no)) from t)).extract('/*')
    from dual
    <TodaysBookings>
    <BookingNo>201000002089</BookingNo>
    <BookingNo>201000002099</BookingNo>
    <BookingNo>201000002101</BookingNo>
    <BookingNo>201000002102</BookingNo>
    <BookingNo>201000002105</BookingNo>
    <BookingNo>201000002106</BookingNo>
    <BookingNo>201000002107</BookingNo>
    <BookingNo>201000002108</BookingNo>
    <BookingNo>201000002109</BookingNo>
    <BookingNo>201000002110</BookingNo>
    <BookingNo>201000002111</BookingNo>
    <BookingNo>201000002112</BookingNo>
    <BookingNo>201000002113</BookingNo>
    <BookingNo>201000002114</BookingNo>
    <BookingNo>201000002115</BookingNo>
    <BookingNo>201000002116</BookingNo>
    <BookingNo>201000002117</BookingNo>
    <BookingNo>201000002118</BookingNo>
    <BookingNo>201000002119</BookingNo>
    <BookingNo>201000002120</BookingNo>
    <BookingNo>201000002121</BookingNo>
    <BookingNo>201000002122</BookingNo>
    <BookingNo>201000002123</BookingNo>
    <BookingNo>201000002124</BookingNo>
    <BookingNo>201000002125</BookingNo>
    <BookingNo>201000002126</BookingNo>
    <BookingNo>201000002127</BookingNo>
    <BookingNo>201000002128</BookingNo>
    <BookingNo>201000002130</BookingNo>
    <BookingNo>201000002131</BookingNo>
    <BookingNo>201000002133</BookingNo>
    <BookingNo>201000002134</BookingNo>
    <BookingNo>201000002136</BookingNo>
    <BookingNo>201000002137</BookingNo>
    </TodaysBookings>
    But when I included it with the rest of xml/sql statements, I get the error ORA-00936: missing expression.
    Thanks.
    Ben

  • I keep getting an error can someone please help

    i am trying to develop a web application using tomcat. i have a servlet that will not compile because of two things. firstly, it says that package beans does not exist and secondle it gives an error becuase im using a user bean here to set some attributes but it keeps saying it cannot resolve symbol User. can someone please help me sort this out. thanks

    You need to package the bean classes in the proper package (in your case beans), and then place them in WEB-INF/classes/<package dirs>.
    Then you need to import the classes in the JSP.
    Cheers!
    ***Annie***

  • Error 2755, please help!

    Iv just downloaded SDK v1.4.2, and after i tried to install it, i got
    "internal error 2775. 1624
    http://forum.java.sun.com/webapps/download/getfile/1.4.2_01-bo6/windows-i586/java 2 sdk, SE v1.4.2_01.msi"
    Please help

    I've sorted the problem!
    I installed SDK offline and it worked

  • I HAVE TRIED TO PAY MY CREDIT CARD ONLINE BUT WHEN I CLICKED ON CONTINUE I GOT A QUICK FLASH ON MY SCREEN SAYING FIREFOX HAS BLOCKED A POP U,CAN YOU PLEASE HELP ME FOR IN THE FUTURE.

    i tried paying by the same means last time and it did the same again,but managed a payment then but today i had to telephone them,but need to pay online in future could you please help me sort this out,thank you m j wilson.

    This can be a problem with the file places.sqlite that stores the bookmarks and the history.
    * http://kb.mozillazine.org/Bookmarks_history_and_toolbar_buttons_not_working_-_Firefox

  • I`m unable to use my Iphone 4S after updating it to the latest software,PLEASE HELP

    It was supposed to update my phone to the latest software but has since stopped working all together and only showing the USB connection and Itunes logo on the black screen when I connect the phone to my computer and it`s been like that for the past 4 hours.I can`t access the phone content,it goes off completely once I disconnect it from my computer;I`m seriously sick and tired of all this software update issues,please help me sort it out.

    I talked with Apple support they tried having me restart my comp and reinstall intunes. Which did not work and he basically said that I would need to go the apple store and probably have to get a new phone. Thank god I backed everything up first.

  • PLEASE, PLEASE HELP: Big problems with my Zen Touch. (Firmware/driver issu

    So here's the deal:
    Last night I thought I'd finally take the time to upgrade my Zen Touch to 2. from .3 or something like that. I noticed that there was a warning saying that this was no small upgrade, and that I should back up everything I have on it.
    I'm glad I did, because now my MP3 player situation is seriously screwed up, big time. During the upgrade process, my computer froze, leaving my Zen Touch without firmware (ok, so firmware version 0.0.0). Upon turning the device on, it boots up in recovery mode. This allows me to either format, clean up, or "reupload" firmware. I've tried all of these options, but the fact is clear that my computer simply will no longer recognize my MP3 player.
    It does, however, recognize it at as a generic storage device. However, this isn't enough for me to reinstall the player's firmware unfortunately.
    So basically, I can't update driver or firmware right now, because my computer won't acknowlege my Zen Touch!
    Somebody please, please help.
    I've already tried using the setup file from http://www.jumpingcholla.com/jce_nomad_ZEN.htm.
    Seriously, please help!

    Sort of success!
    I now finally have firmware 2. installed on my Zen Touch! Yeah! I'm not entirely sure how I did it, and I'm not bothering to find out, I'm just glad I finally got it on there.
    But some problems still remain. After all this fiddling with my driver and firmware and whatnot, my computer just doesn't see my MP3 the same way as it used to. Before, it was great, all I had to do was plug her in and I could bring up Zen Explorer in Windows Explorer, or organize my stuff in Creative MediaSource.
    Now that's not the case. The only way I can sort of add stuff to my player now is by going into Windows Explorer, which is still more or less acknowleging my player as a "portable device". Granted, there is a dri've called "My Zen", but it doesn't bring up Zen Explorer like it used to when I click on it. Furthermore, when I go into MediaSource, I can't select it as a location, there just isn't anything there.
    It almost seems as if my computer thinks I'm just using a portable hard dri've. Is there anyway I can tell it that it's an MP3 player, too?
    Thanks!

  • I can't scroll down to read my ebook. I have to change pdf view after pressing pg dn to view the next page. Please help!

    I can't scroll down to read my ebook. I have to change pdf view after pressing pg dn to view the next page. Please help!

    Sorted out the problem myself - secret is you have to go to Full Screen view to be able to scroll down. Easy as that - but not so apparent if you are new to this.

  • Somebody please help me for sorting arrays!!

    Hello.
    I have a problem like this. (http://www.sfusd.edu/schwww/sch697/depts/math/simon/ICTJAVA/WebLessons/APCSL27/APCSL27-1-7.html)
    public class Item implements Comparable
    private int myId;
    private int myInv;
    public Item(int id, int inv)
    myId = id;
    myInv = inv;
    public int getId(){ )
    public int getInv(){ }
    public int compareTo(Object otherObject){ }
    public boolean equals(Object otherObject){ }
    public String toString(){ }
    public class Store
    private Item[] myStore;
    public Store(String fileName) { }
    public void displayStore()
    public String toString(){ }
    public void doSort() { }
    private void quickSort(Item[] list, int first, int last)
    private void loadFile(String inFileName)
    The first line of file50.txt contains the number of id/inventory integer pairs listed on subsequent lines. The idea behind the data type item is the simulation of an item in a store, nearly all of which use a bar code for identification purposes. For every item in a store we keep track of an id value and an inventory amount. So file50.txt looks like this:
    50
    3679 87
    196 60
    17914 12
    18618 64
    2370 65
    etc. (for 45 more lines)
    Each id value in file50.txt will be unique.
    Assignment:
    Write a program that solves the following sequential events:
    loads the data file, file50.txt, as a collection of Item types maintained in a Store object
    sorts the data using quickSort
    prints the data , now in increasing order based on the id field of an Item object
    The printing should add a blank line after every 10 items in the output. Include a line number in the output. For example:
    Id Inv
    1 184 14
    2 196 60
    3 206 31
    4 584 85
    5 768 85
    6 2370 65
    7 3433 5
    8 3679 87
    9 4329 64
    10 5529 11
    11 6265 58
    12 6835 94
    13 6992 76
    14 7282 73
    15 8303 90
    16 9267 68
    etc.
    You will need to complete the getId(), getItem(), compareTo(), equals() and toString() methods for the Item class.
    You will need to complete the Store() constructor, displayStore(), loadFile(), quickSort() and toString() methods for the Store class.
    That's the assigned project.
    this is a side story. I'm a highschooler, and my teacher always hangs out on the internet, teaching nothing. and like this, he just print some problems from the internet and give it to the students. is there a handout about lesson? no. is this always been like this? yeah...
    I have no idea how to right a method called getId(), getInv(), etc...
    would anybody please... please help me?
    p.s.
    the file50.txt is
    on http://www.sfusd.edu/schwww/sch697/depts/math/simon/ICTJAVA/WebLessons/APCSL27/file50.txt
    quicksort is in
    http://www.sum-it.nl/QuickSort.java here.
    somebody please... help me out...

    well you're really going to have to at least do a quick skim of:
    http://java.sun.com/docs/books/tutorial/getStarted/index.html
    And also how to use a browser and browse the API Docs
    especially for: Comparable
    You'll also get flamed for just posting a Homework assignment with no evidence of your own attempts to solve it, OR for not formatting the code with
    [ c o d e ] [ / c o d e ]
    I suppose you get some points if you answer some of the questions?
    Try the easy parts first:
    Complete the methods of the class Item
    Ignore the deliberate Typos in the assignment
    see how you have the class members defined already like:
    private int myId;                         // The guy couldn't be bothered to document his code
    private int myInv;                       // So you will have to.......document itlook at this:
    public int getId() {}As it is the compiler will just say : Missing method body, or declare abstract...
    Your job is to guess what it should do from the 'signature'
    It must return an int and that should be related to Id neh?
    So try things like:
         @return the value of the myId field.
    public int getId()
              return       this.myId;      // return myId would do as well
         Sets the value of myId field
         @param  newId   the new Id to set.
      public void setId( int newId )
           this.myId = newId;             // the old value is replaced with the new
      }do the rest of the simple obvious methods.
    You will get some marks and improve your confidence with simple Java
    Read The API doc on Comparable Interface:
    Decide Carefully how you want to "Order" Objects of type Item.
    In this case this will probably depend first on myId and then subsequently on myInv
    The Comparable interface helps Sorting methods decide qhich object comes first when sorting.
    you will need ssomething like this.
         Implements Comparable - Read the API
    public int compareTo( Object o ) throws ClassCastException, NullPointerException
        if( o == null )
             throw new NullPointerException("Blah blah blah");
       if( !( o instanceof Item ) )
              throw new ClassCastException("Apples and Oranges!");
      Item  item = ( Item ) o;  // Cast o to an Item so it can be checked
      if( this.getId()  < item.getId() )
             return -1;                         // Signal that "this"is less than o
      if ( this.getId() > item.getId() )
            return 1;
      // here both items have the same  myId field
    if( this.getInv() < item .getInv() )
             return -1;
    if( this.getInv() > item.getInv() )
           return 1;
      return 0;                     // they are at the same sort order
    }You use that method like:
      Item a;
      Item b;
      if( a.compareTo( b ) < 0 )
          //blah blah
      }To write the equals method read the API it is similar to compareTo()
    To Read The file : Search on this forum for reading a file line by line.
    Check the API.
    ALso if you have installed Java:
    There are many examples of how to do this in the demo directory
    Even one on QuickSort ---
    So plug away..................

  • Simple array comparison not working. Please HELP!

    I have been struggling to solve this problem for a few days now, and I'm slowly losing my mind.
    I am in Adobe Acrobat 10.
    I have a group of button fields called: btn0, btn1, btn2, etc.
    I have a group of text fields called: txt0, txt1, txt2, etc.
    I have a script that takes the value of txt0 and makes it the caption for btn0, and so on.
    I have a script that sets the MouseUp action of btn0 to setFocus to txt0, and so on.
    These scripts work fine.
    I have a script that takes the values of all the txt fields and puts them in an array, and sorts it.
    I have a script that takes the array[0] item and makes it the caption for btn0, and so on (alphabetizing my list of buttons).
    Those scripts work fine.
    I am trying to compare the value of the array[0] item to each of the txt fields to find the match, and then set the MouseUp action of btn0 to setFocus to the matching txt field, and so on (so my alphabetized list points to the correct locations).
    This is where I'm at a loss.
    Here is what I have:
    //specified the txt fields
    var txt0 = this.getField("Z name");
    var txt1 = this.getField("A name");
    //etc.
    //put their values into an array called rxArray
    var rxArray = [txt0.value, txt1.value]; //etc.
    //sorted the array
    rxArray.sort();
    //set the captions equal to the sorted array items
    for (var i = 0; i < 5; i++) {
        var b = ("btn" + i);
        this.getField(b).buttonSetCaption(rxArray[i]); //works fine; alphabetizes the list of buttons
        //below is what goes wrong
        for(var x = 0; x < 5; x++) {
            var r = ("txt" + x);
            if(rxArray[i] == r.value){
                var s = (r + ".setFocus();");
                this.getField(b).setAction("MouseUp", s);
    //end
    Here is what I know:
    The alphabetizing and labeling works fine, but the buttons' MouseUp scripts don't work at all. Nothing happens.
    If I change the following piece of the above script:
            if(rxArray[i] == r.value){
                var s = (r + ".setFocus();");
                this.getField(b).setAction("MouseUp", s);
    To this:
            if(rxArray[i] == txt1.value){
                var s = (r + ".setFocus();");
                this.getField(b).setAction("MouseUp", s);
    Because rxArray[0] does equal the value of txt1 ("A name"), then the MouseUp script for btn0 gets set to:
    txt4.setFocus();
    So I know that, each time the nested loop runs, the if statement is true, and the setFocus script updates. Until the end of the loop, leaving the setFocus as the last item run. So why doesn't my script work? It should only update the setFocus script IF the array item matches the txt field, and should set it to THAT txt field.
    Please please help. I know I'm missing something simple in there somewhere.

    @Try67:
    That's a good question. I was running into some other issues and have revamped my code. Here is what I have in my test file:
    A list of five buttons and a list of five text fields. One additional button that sets the focus to the next empty text field to add a new item, and two additional buttons, one that sorts my list alphabetically, and one that unsorts it.
    with the following field names
    The sort button calls function sortName and the unsort calls function sortNumber (the order of entry).
    Here are those scripts in final form:
    function sortName() {
    //first reset the captions for the buttons to blank
    for (var a = 0; a < 5; a++) {
        var b = ("btn" + a);
        this.getField(b).buttonSetCaption("");
    var txt0 = this.getField("t0");
    var txt1 = this.getField("t1");
    var txt2 = this.getField("t2");
    var txt3 = this.getField("t3");
    var txt4 = this.getField("t4");
    var rxArray = [txt0.value, txt1.value, txt2.value, txt3.value, txt4.value];
    for(var m = rxArray.length - 1; m > -1; m--){
        if(rxArray[m] == ""){
            rxArray.splice(m, 1);
    rxArray.sort();
    var newArray = [txt0, txt1, txt2, txt3, txt4];
    for(var n = newArray.length - 1; n > -1; n--){
        if(newArray[n].value == ""){
            newArray.splice(n, 1);
    for (var i = 0; i < rxArray.length; i++) {
        var b = ("btn" + i);
        this.getField(b).buttonSetCaption(rxArray[i]);
        for (var x = 0; x < newArray.length; x++) {
            if(rxArray[i] == newArray[x].value){
                var s = ("this.getField('" + newArray[x].name + "').setFocus();");
                this.getField(b).setAction("MouseUp", s);
    //end
    function sortNumber() {
    var txt0 = this.getField("t0");
    var txt1 = this.getField("t1");
    var txt2 = this.getField("t2");
    var txt3 = this.getField("t3");
    var txt4 = this.getField("t4");
    var newArray = [txt0, txt1, txt2, txt3, txt4];
    for (var x = 0; x < newArray.length; x++) {
        var b = ("btn" + x);
        this.getField(b).buttonSetCaption(newArray[x].value);
        var s = ("this.getField('" + newArray[x].name + "').setFocus();");
        this.getField(b).setAction("MouseUp", s);
    //end
    As you can see, I've used the array lengths rather than fixed numbers, except when clearing the button values. I use a number there because there is no array to reference and didn't feel like making an array just for that. The number of buttons won't change.
    I've also added in a splice() method to remove the blank entries from my arrays when appropriate (making using the array length even more important).
    The result of the sort is:
    The only quirk I've found in all this is with the Add New button, which calls function addNew, which is:
    function addNew() {
    var txt0 = this.getField("t0");
    var txt1 = this.getField("t1");
    var txt2 = this.getField("t2");
    var txt3 = this.getField("t3");
    var txt4 = this.getField("t4");
    var newArray = [txt0, txt1, txt2, txt3, txt4];
    for (var i =  newArray.length - 1; i > -1 ; i--) {
        if (newArray[i].value == "") {
            newArray[i].setFocus();
    //end
    For this, I would have though that running through the array from start to finish looking for the first empty text field and setting the focus to it would have been correct. But that resulted in the last empty text field being focused. So I reversed the for loop to run finish to start, and the result was that the first empty field was focused. Not sure why that is...

Maybe you are looking for