Help with a FOR loop and an object array

I need to make a for loop that takes an array of objects that contain the parameters year, type, and model (all ints) and sort by year, then divide the array in all the objects with the same year and sort them by type, then divide the array again into the objects with the same year AND type and sort them by model.
the object a Dress objects, the get methods are get+nameof parameter.
the array is a 1D array called Dresses.
I have made a paralell array to store the value of the parameters and sort that then move the array acording to that sorted array. The problem is in the division of the array.

We'll give your request to do (or finish) your homework for you the attention it deserves.

Similar Messages

  • Please help with the FOR loop and the array..

    I was trying to place some words in the Movie Clip
    "TextPanel" and set a
    random position to each of them.
    But it's not working.
    1) I created a Movie Clip "word" and inside that MC I created
    a text field
    and gave it an identifier "textFiled".
    2) The linkage name for Movie Clip "word" I set to "word".
    3) In the actionscript I created an Array called "aWords".
    4) Then I created a FOR loop that should
    place (attach) Movie Clips "word0", "word1", "word2" and
    "word3" to the
    movie clip TextPanel, and set the textField text for each of
    them to the
    text from the Array.
    But the script attaches 4 Movie Clips with a name
    "Undefined", instead of 4
    different names (from the Array).
    What is wrong with this script?
    var aWords:Array = [apple,banana,orange,mango];
    for(i=0;i<aWords.length;i++){
    var v = TextPanel.attachMovie("word","word"+i,i);
    v.textFiled.text = aWords
    v._x = randomNumber(0,Stage.width);
    v._y = randomNumber(0,Stage.height);
    Thanks in advance

    But in my Post I already wrote v.textFiled.text = aWords
    so I don't understand what were you correcting..
    And one more:
    I have tested it by changing the
    v.textFiled.text = aWords; to v.textFiled.text = "some
    word";
    and it's working fine.
    So there is something wrong with the Array element, and I
    don't know why..
    "aniebel" <[email protected]> wrote in
    message
    news:ft2d5k$lld$[email protected]..
    > Change:
    > v.textFiled.text = aWords;
    >
    > to:
    > v.textFiled.text = aWords
    >
    > It needs to know which element inside the array you want
    to place in the
    > textfield (or textfiled) :)
    >
    > If that doesn't work, double check that your instance
    name is correct
    > inside
    > of "word".
    >

  • I need help with my for loop in this array

    Ok well, I can't get my code to work. Also, please remember that this is just my draft so it isnt pretty. I will fix it up later so please look at it. The thing I want to do is look into the array for a time that matches what the user entered and return the toString() of that one. I know there is something wrong with my for loop but I cant figure how to fix it. please help. here is what i have so far:
    import javax.swing.JOptionPane;
    public class Runner
        public static void main (String[] args)
            String timeStr;
            int time, again, optiStr;
            Inbound[] in = new Inbound[25];
             in[0]=new Inbound ("",0,"On Time num0");
             in[1]=new Inbound ("",2,"On Time num1");
             in[2]=new Inbound ("",3,"Delayed num2");
             in[3]=new Inbound ("",4,"On Time");
             in[4]=new Inbound ("",5,"On Time");
             in[5]=new Inbound ("",6,"Canceled");
             in[6]=new Inbound ("",1,"Canceled num6");
             in[7]=new Inbound ("",8,"On Time");
             in[8]=new Inbound ("",9,"Delayed");
             in[9]=new Inbound ("",10,"On Time");
             in[10]=new Inbound ("",11,"Delayed");
             in[11]=new Inbound ("",12,"On Time");
             in[12]=new Inbound ("",13,"Delayed");
             in[13]=new Inbound ("",14,"On Time");
             in[14]=new Inbound ("",15,"On Time");
             in[15]=new Inbound ("",16,"On Time");
             in[16]=new Inbound ("",17,"Canceled");
             in[17]=new Inbound ("",18,"On Time");
             in[18]=new Inbound ("",19,"On Time");
             in[19]=new Inbound ("",20,"Canceled");
             in[20]=new Inbound ("",21,"On Time");
             in[21]=new Inbound ("",22,"Delayed");
             in[22]=new Inbound ("",23,"On Time");
             in[23]=new Inbound ("",24,"Cancled");
             in[24]=new Inbound ("",7,"On Time num24");
            do{
                timeStr = JOptionPane.showInputDialog ("In military time, what hour do you want?");
                time = Integer.parseInt(timeStr);
                if (time<=0 || time>24)
                 JOptionPane.showMessageDialog (null, "Error");
                 optiStr = JOptionPane.showConfirmDialog (null, "If you want Incoming flights click Yes, but if not click No");
                if (optiStr==JOptionPane.YES_OPTION)
    //(ok this is the for loop i am talking about )
                    for (int index = 0; index < in.length; index++)
                      if ( time == Inbound.getTime())
                   JOptionPane.showMessageDialog (null, Inbound.tostring());  //return the time asked for
    //               else JOptionPane.showMessageDialog (null, "else");
                }//temp return else if failed to find time asked for
    //             else
    //               if (optiStr==JOptionPane.CANCEL_OPTION)
    //                 JOptionPane.showMessageDialog(null,"Canceled");
    //              else
    //                {Outbound.run();
    //                JOptionPane.showMessageDialog (null, "outbound");}//temp
                  again=JOptionPane.showConfirmDialog(null, "Try again?");
            while (again==JOptionPane.YES_OPTION);
    }any help would be greatly appriciated.

    rumble14 wrote:
    Ok well, I can't get my code to work. Also, please remember that this is just my draft so it isnt pretty. I will fix it up later so please look at it. The thing I want to do is look into the array for a time that matches what the user entered and return the toString() of that one. I know there is something wrong with my for loop but I cant figure how to fix it. please help. here is what i have so far:
    >//(ok this is the for loop i am talking about )
    for (int index = 0; index < in.length; index++)
    if ( time == Inbound.getTime())
    JOptionPane.showMessageDialog (null, Inbound.tostring());  //return the time asked for
    Inbound.getTime() is a static method of your Inbound class, that always returns the same value, I presume? As opposed to each of the 25 members of your array in, which have individual values?
    Edited by: darb on Mar 26, 2008 11:12 AM

  • Need help with a for loop

    Hi all
    I have a dir that has a list of folders that are created using php that my customers upload to. the PHP creates a new folder using the system date on the days that they upload. (using this format yyyymmdd)
    What I am trying to do is loop thou the folders and get todays folder and list the files that are in todays folder. I have been able to do this up to the point of if a customer folder does not have a folder called todays date.
    I know I need some sort of try / catch but don't know what.
    Can anyone help me please
    Thanks for you time and help in advance
    Craig
      public void getfolderList() {
        File dir = new File("/Users/craig/Documents/jBuilder_Epod/copy");
        File[] getFolderNames = dir.listFiles();
        if (getFolderNames != null) {
          for (int gf = 0; gf < getFolderNames.length; gf++) {
            String store = "" + getFolderNames[gf];
            if (!store.endsWith(".DS_Store")) { // This is a mac file name Only
              String folderName = "" + getFolderNames[gf];
              if (!store.endsWith(".DS_Store")) { // This is a mac file name Only
                //I need to have some sort of try and Catch here.
                // If there is no Folder called "todaysFileName" I need to go to the next folder
                //i.e. stop the for loop and go to next
                String setTodaysFileName = folderName + "/";
                String todaysFileName = setTodaysFileName + systemDate;
                File todaysFolder = new File(todaysFileName);
                File[] todaysFiles = todaysFolder.listFiles();
                for (int td = 0; td < todaysFiles.length; td++) {
                  todaysFileName = "" + todaysFiles[td];
                  System.out.println("There is no folder Today........" +
                                     todaysFileName);
      }

    A quick guess would be that after the sStatement
      File[] todaysFiles = todaysFolder.listFiles();todaysFiles is null if todaysFolder doesn't exist and you get a NullPointerException when trying to access todaysFiles.length in the following for-loop.
    If that doesn't help, please be a bit more precise what kind of Exception occurs...

  • Need help with basic "for" loops!

    Here is my prompt for class:
    Write a program that prompts the user to enter a sentence from the keyboard using JOptionPane.showInputDialog.
    The program will print the characters back with the first letter of each word changed from lower case into upper case. If you have a capital letter in the original line and it is not the first letter of a word, then this letter should be switched from upper case to lower case. The only capital letters that should appear in the line must be the beginning letter of every word in the line. All other characters will remain the same.
    I figured everything out except for one part. How do I make the first letter of each word change from lower case into uppercase? How do I switch a letter that is uppercase in the middle of a word to lowercase? Last but not least, how do I make sure that the only capital letters in the sentence are the first letter of each word?
    I need to do this using for Loops, charAt(), and if/else statements because this is just an intro class. I just can't figure this last part out! Help please!

    String words = ...;
    StringBuilder builder = new StringBuilder();
    for (int i = 0; i < words.length; i++) {
    char c = words.charAt(i);
    boolean isUpper = Character.?(look up the methods in java.lang.Character)
    boolean isLetter = ? (there are actually 2 ways to do this. Hint: you can use <= and >= and && to solve this)
    if (!isLetter) {
    continue;
    } else {
    // check if this is the start of the word. How do you know that you are at the start of a word?
    if (!isUpper && isStartOfTheWord) c = Character.toUpperCase(c); //Hint: there is a way you can do this with x + y
    else if (isUpper) //make c lower case
    builder.append(c);
    return builder.toString();

  • Creating a function with  a for loop and %type

    Hello,
    I am trying to create a function which contains a for loop as well as %type.
    This function is on a student table and i am trying to create a function which will display the zip which is a varchar2(5).
    I need to do this through this function.
    However, I can't seem to get it running.
    Can anyone help?
    below is what i tried as well as other options and was not successful.
    I also displayed my error with the show error command.
    SQL> create or replace function zip_exist
    2 return varchar2
    3 is
    4 v_zip student.zip%TYPE;
    5 cursor c_zip is
    6 select zip
    7 from
    8 student
    9 where zip=zip;
    10 begin
    11 open c_zip;
    12 v_zip IN c_zip
    13 loop
    14 v_zip:=c_zip%TYPE;
    15 end loop;
    16 close c_zip;
    17 end;
    18 /
    Warning: Function created with compilation errors.
    SQL> show error
    Errors for FUNCTION ZIP_EXIST:
    LINE/COL ERROR
    12/7 PLS-00103: Encountered the symbol "IN" when expecting one of the
    following:
    := . ( @ % ;
    16/1 PLS-00103: Encountered the symbol "CLOSE"
    SQL>
    kabrajo

    user10873577 wrote:
    Hello,
    I am trying to create a function which contains a for loop as well as %type.
    This function is on a student table and i am trying to create a function which will display the zip which is a varchar2(5).
    I need to do this through this function.
    However, I can't seem to get it running.
    Can anyone help?
    below is what i tried as well as other options and was not successful.
    I also displayed my error with the show error command.
    SQL> create or replace function zip_exist
    2 return varchar2
    3 is
    4 v_zip student.zip%TYPE;
    5 cursor c_zip is
    6 select zip
    7 from
    8 student
    9 where zip=zip;
    10 begin
    11 open c_zip;
    12 v_zip IN c_zip
    13 loop
    14 v_zip:=c_zip%TYPE;
    15 end loop;
    16 close c_zip;
    17 end;
    18 /
    Warning: Function created with compilation errors.
    SQL> show error
    Errors for FUNCTION ZIP_EXIST:
    LINE/COL ERROR
    12/7 PLS-00103: Encountered the symbol "IN" when expecting one of the
    following:
    := . ( @ % ;
    16/1 PLS-00103: Encountered the symbol "CLOSE"
    SQL>
    kabrajoTry This
    Create a sample table
    SQL> create table student(id number(10),zip varchar2(5));
    Table created.Insert the record
    SQL> insert into student values(1111,'A5454');
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> select * from student;
            ID ZIP
          1111 A5454
    SQL> create or replace function zip_exist(v_id number)
      2   return varchar2
      3   is
      4   v_zip student.zip%TYPE;
      5  BEGIN
      6   select zip
      7   INTO v_zip
      8   FROM student
      9   where id=v_id;
    10   Return v_zip;
    11  EXCEPTION WHEN NO_DATA_FOUND THEN
    12                  RETURN 'INVALD';
    13  WHEN OTHERS THEN
    14                 return  'NA!';
    15   end;
    16  /
    Function created.
    SQL> set serveroutput on
    SQL> select zip_exist(1111) from dual;
    ZIP_EXIST(1111)
    A5454
    SQL> select zip_exist(2222) from dual;
    ZIP_EXIST(2222)
    INVALDHope this helps
    Regards,
    Achyut K

  • Need help with a For loop that uses a Break statement

    I need to create a for loop which counts down from 100-50 and divides the number being counted down by a counter. Can anyone help me?
    public class Break
    public static void main ( String args []) (;
         int total = 0
         int counter = 0
         for { (int number = 100; total >=50; total --)
         if (counter == 0)
         break;
         } // end of for loop
         int output = number/counter
         system.out.printf("The number is" %d output/n)
         }// end of method main
    }// end of class Break

    Im sorry I didnt explain myself very well i do not need the break statement at all.
    I now have this code:
    public class BreakTest
       public static void main( String args[] )
          int count; // control variable also used after loop terminates
         for (int i = 100; i >= 50; i = ++count)
       if (i >= 50) {
        continue;
          System.out.printf( "\nBroke out of loop at count = %d\n", count );
       } // end main
    } // end class BreakTest
    /code]
    and i get these error messages:
    F:\csc148>javac BreakTest.java
    BreakTest.java:9: variable count might not have been initialized
         for (int i = 100; i >= 50; i = ++count)
                                          ^
    BreakTest.java:15: variable count might not have been initialized
          System.out.printf( "\nBroke out of loop at count = %d\n", count );
                                                                    ^
    2 errors                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Need help with the for loop

    Hello,
    I hope someone can point me in the right direction for my next assignment. I am very new at Java programming. For my next assignment for class I will need expand my previous program which was a mortgage calculator. The first assignment we wrote a program to show the monthly payments of a $200,000 loan at 5.75% for 30 years. Now we have to output all 360 monthly payments with pauses in between so it doesnt scoll off the page. The calculation that we use is:
    month_payments = (principle * monthlyinterest) / (1-Math.pow(1 + monthlyinterest, - months));
    My question is how do I get the correct calculation outputed 360 times. I would like to use the "for loop" to do this. Also what is the correct way to do the pause command? I do not want someone to write the code, I just want some help to where I need to start off, I want to learn this on my own.
    Thanks in advance,
    DC

    for (int i ; i < 10 ; i ++ ) { System.out.println("Come sail away"); }
    or;
    int i = 0;
    while(i < 10)
        i++;
        System.out.println("Come sail away");
    }

  • Need help with a for loop - string checking

    I am trying to create a for loop to make sure a user entered string contains only letters but something doesn't take. No errors, but the inner loop of try again doesn't ever come into play. What am I missing please.
         String k = keyboard.nextLine();
         for (int i = 0; i < k.length(); i++)
              char c = k.charAt(i);
              int m = c; 
              if (((m < 97) && (m > 122)) || ((m < 65) && (m > 90)))
                        System.out.print("Try again please: ");
                        k = keyboard.nextLine();
    System.out.println(k);

    molested,
    (you and BigDaddyLoveHandles should get on well)
    I would use regular expression for that... which would look something like this...
    // get response containing at least one letter.
    while (true) {
      String response = keyboard.nextLine();
      if( response.matches("[a-zA-Z]+") ) break;
      System.out.print("Try again please: ");
    }Message was edited by: corlettk - frog got the {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Need help with BAPI_PR_CREATE for BOM and Service

    Hi all,
    My requirement is to do a mass conversion program for PR creation, so I'm planning to use either BAPI_REQUISITION_CREATE or BAPI_PR_CREATE.
    The difficult part is that, I need to be able to change the compononent (BOM) for subcontracting and also be able to input service lines for service type PR.
    I know that for service I can use BAPI_REQUISITION_CREATE, it has a specific structure for that, but does BAPI_PR_CREATE provide the same functionality as well?
    As for altering component (BOM) , I couldn't find any parameter in both function to do the work.
    Does anyone have this requirement before and can advice me about this. Thanks in advance.

    My problem is solved.
    I was be able to convince the user to use standard BOM insteand of customizing them in PR. As for service, I use BAPI PR_REQUISITION_CREATE

  • Need help with Italics for ePub and InDesign CS5

    Could someone help a me out. I just can not find the answer to this and I know it should be simple, I am just missing it.
    I am creating an ePub from CS5 InDesign. All I want to do is have the italics that are shown in the text box in InDesign, show up in the epub file.
    I would prefer not to say what I have done (I think I have tried everything, but obviously I did them all wrong, so no point listing them) and I am hoping someone can do a simple, step by step guide to how to have italics show up in the ePub file.
    Sorry if this question is beneath everyone, this is really annoying that I can not figure this out on my own.

    Yup, done this.
    In InDesign, the text is Italic. It has the Character Style Italic associated with it.
    But when I export to ePub, it is not italic.
    Here is the HTML from the xhtml file for a single line of what is supposed to be italic text,
    <p class="normal normal-override-2" xml:lang='en-us'><span class="italic italic-override">Words that should be Italic.</span></p>
    The above line does not show up as italic in any of the 3 readers I am using to test with.
    Now, in the css sheet, the span.italic-override does not have anything associated to font-style. If I manually add the font-style italic, then re-pack everything, it works.
    It just seems to me a bit absurd to have to export the epub, unpack it, open it in dreamweaver, add the font-style, and repack it just to have something as simple as italic work.
    So, I am missing something, I get that... I just can't figure out what!

  • Need help with a java loop and word program

    do you know any way to get a Scanner object to select a random string in a text file?
    ok pretty much I have a text file that isa list of 5 letter words. I need to select one at random.
    the only way I could think was to scan the file, get the entire nu of words, have Math.random choose a random nu then loop scanner.next() and have the loop condition run the Math.random amount of times
    but... when I do that I CANT ACCESS THE WORD OUTSIDE THE STUPID LOOP grrr...
    i'm annoyed lol
    this is the loop code that selects the random word
    int random = (int) Math.random() * numberOfWordsInFile + 1;
    int chooseLoopCount = 0;
    while (random >= chooseLoopCount)
    String theWord = scan.next();
    theWord = theWord.toLowerCase();
    chooseLoopCount += 1;
    see it's assigned properly to be the output of the scanner in all lower case letters, but outside the loop, the variable doesn't even exist
    anyway any suggestions would be awesome. thx

    String theWord = null;
    while (...)
      // set theWord in the loop
    // access to theWord is now available here, as it is in scope.
    // bear in mind if your loop didn't get executed, theWord is still null

  • Need help with trigger for whitespace and caps validation

    I need to create a table trigger that will generate an error whenever a specific column does not contain all caps or has whitespace when records are either inserted or updated. I'm new to writing SQL, so any help is appreciated!

    In 10g
    SQL> create or replace trigger trigg_sample
      2  before update or insert on sample
      3  for each row
      4  declare
      5  lv_pos number;
      6  begin
      7  select regexp_instr(:new.col1,'[a-z|( )]') into lv_pos from dual;
      8  if lv_pos > 0 then
      9  raise_application_error(20000,'The column contains lowercase or white space characters');
    10  end if;
    11  end;
    12  /
    Trigger created.
    SQL> desc sample;
    Name                                      Null?    Type
    COL1                                               VARCHAR2(20)
    SQL> insert into sample values('DFD') ;
    1 row created.
    SQL> insert into sample values('dfdfd') ;
    insert into sample values('dfdfd')
    ERROR at line 1:
    ORA-21000: error number argument to raise_application_error of 20000 is out of
    range
    ORA-06512: at "XLS_ADMIN.TRIGG_SAMPLE", line 6
    ORA-04088: error during execution of trigger 'XLS_ADMIN.TRIGG_SAMPLE'
    SQL> insert into sample values('DFDF ') ;
    insert into sample values('DFDF ')
    ERROR at line 1:
    ORA-21000: error number argument to raise_application_error of 20000 is out of
    range
    ORA-06512: at "XLS_ADMIN.TRIGG_SAMPLE", line 6
    ORA-04088: error during execution of trigger 'XLS_ADMIN.TRIGG_SAMPLE'
    SQL>

  • Need Help with logins for SQLPLUS and Database Control

    Hi,
    I am new to Oracle. I installed "Oracle 10g Standard Version" on Win XP Pro. I have two questions regarding logins:
    (1)     After installing the software I used “dbca” to create a General Purpose database. At the end of the database creation I clicked on the Password Management button and I entered the password for SYS, SYSTEM and SCOTT. Then at the DOS command prompt I typed “SQLPLUS” and I can login as SCOTT and system, but I cannot as login as sysdba or sysoper. I get invalid username/password; logon denied message.
    But I can type “SQLPLUS /NOLOG” and then issue command “connect /as sysdba” and connect successfully as sysdba. Any idea why I cannot login sysdba or sysoper?
    (2)     When I go to windows Start->All Programs->Oracle - OraDb10g_home1 and select “Database Control”. A browser windows open up Database Control page. I cannot start Listener nor Start up a Database Instance. No matter whether I try SYS, SYSDBA, SYSOPER or SCOTT I cannot login. Any idea what is going on here?
    At the SQLPLUS command prompt if I enter “select status from v$instance;” I get status as “OPEN”.
    I am lost in Oracle world as a typical newbie. Many thanks in advance for any advice or pointers.
    Thanks
    Joe

    (1) Yes I can login if I type "sqlplus / as sysdba". Does that mean "sysdba" doesn't have a password?
    (2) when I run "emctl status dbconsole", I get a message saying "Environment variable ORACLE_SID not defined. Please define it." Can someone tell me what should I do?
    Thanks
    Joe

  • Need help with a for loop please

    Hello,
    I want to do the following:
    double V[][] = sphere.V2;
    double polygon[][][] = {
         { V[0], V[1], V[2] },
    { V[1], V[2], V[3] },
    { V[2], V[3], V[4] },
    { V[3], V[4], V[5] },
    { V[4], V[5], V[6] },
    { V[124], V[125], V[126] },
    How can I set up a loop to initialize the values of polygon so that I dont have to type it all out?
    Thanx a lot
    -Big_Goon

    Any suggestions?
    -Big_Goon

Maybe you are looking for

  • USB mouse does not work

    hi All I bought a new HP laptop few days ago,when I installed Win7 pro on it after a few minutes, the usb mouse stopped working. Its light still lights up ,but the cursor does not react. The drivers of the device are installed and working properly. t

  • How do i add to a published site?

    i am defeated... how do i access an iWeb site i have published to add another page? i launched iWeb and the "visit a published site" is grayed out. i can only find my site by clicking on the link in an e-mail i sent announcing it, and then i am only

  • Projector span 2 monitors

    Does anyone know how to get a flash projector to span or stretch across two monitors in full screen mode? I have set the stage dimensions to 2356 pixels in width to appear on both my monitors. When I run the project in full screen mode (no window ui)

  • Redirect from ROOT

    I am trying to redirect to the welcome page from ROOT. When www.mydomain.com is called from a browser, the servlet inside ROOT should redirect to another web page in webapps/welcome/index.jsp What I did: com.index.Redirect public class Redirect exten

  • Is it possible to customizer entity custom property input interface?

    Hi, I have made a customize validatioin rule and a swing which used to input validation rule parameter. When I costomize validation rule parameter,I only need to do supply three file : PLSQLRule.java,PLSQLRuleBeanInfo,PlsqlRuleCustomizer.java,and the