Program doesnt work, tried to make it into array list

I tried to change this from an array to arraylist and all i got was allot of errors! i was wondering if anyone could help?
import java.util.*;
import chn.util.*;
public class final_proj
public void quicks(int first, int last);
int g = first, h = last;
ArrayList myArrayList = new ArrayList();
int midIndex = (first + last) / 2;
int dividingValue = list[midIndex];
do
while (list.get(g) < dividingValue)
g++;
while (list.get(h) > dividingValue)
h--;
if (g <= h)
//swap(list[g], list[h]);
int temp = list.get(g);
list.get(g) = list.get(h);
list.get(h)= temp;
g++;
h--;
while (g < h);
if (h > first)
quickSort (list,first,h);
if (g < last)
quickSort (list,g,last);
//not offering money
ERRORS
\\ls-server\userdata\08jleslie\Java\MyProjects\final_proj.java:5: missing method body, or declare abstract
public void quicks(int first, int last);
^
\\ls-server\userdata\08jleslie\Java\MyProjects\final_proj.java:9: cannot resolve symbol
symbol : variable first
location: class final_proj
int g = first, h = last;
^
\\ls-server\userdata\08jleslie\Java\MyProjects\final_proj.java:9: cannot resolve symbol
symbol : variable last
location: class final_proj
int g = first, h = last;
^
\\ls-server\userdata\08jleslie\Java\MyProjects\final_proj.java:13: cannot resolve symbol
symbol : variable first
location: class final_proj
int midIndex = (first + last) / 2;
^
\\ls-server\userdata\08jleslie\Java\MyProjects\final_proj.java:13: cannot resolve symbol
symbol : variable last
location: class final_proj
int midIndex = (first + last) / 2;
^
The system is out of resources.
Consult the following stack trace for details.
java.lang.OutOfMemoryError

import java.util.*;
import chn.util.*;
public class Test
public void quicks(int first, int last)
int g = first, h = last;
ArrayList myArrayList = new ArrayList();
int midIndex = (first + last) / 2;
int dividingValue = list[midIndex];
     do
          while (list.get(g) < dividingValue)
               g++;
          while (list.get(h) > dividingValue)
          h--;
          if (g <= h)
               //swap(list[g], list[h]);
               int temp = list.get(g);
               list.get(g) = list.get(h);
               list.get(h)= temp;
               g++;
               h--;
while (g < h);
     if (h > first)
          quickSort (list,first,h);
     if (g < last)
          quickSort (list,g,last);
}An improvement but still doesn't compile because.
1). import chn.util.*; ???
2). int dividingValue = list[midIndex]; makes no sinse.
3). Variable list is never declared.

Similar Messages

  • My iphone works well...then suddenly hang and turn off...trying to turn on, doesnt work trying the power and home button at the same time for many time doesnt work either. try to charged but not charging...trying to access in itunes, cannot access...

    my iPhone works well...suddenly hang when im on the phone...trying to reset with the home and power button, doesnt work, trying to charge for for several hour..its not charging, trying to access in itunes,,cannot acces.....what to do...please help

    Has it ever gotten wet?..   I'd make an appointment with Genius bar at an Apple store, there's something majorly wrong that a simple 'reset' isn't going to fix...
    Sorry...

  • My Sound doesnt work.. menu makes sound  but not home sharing

    I can click through the menu and apple TV works..
    But the sound when playing a movie through home sharing doesnt work..
    Whats up?

    Update:
    Works with Quicktime.. It does play sound..
    DOESNT PLAY SOUND IN ITUNES... Thats why I cant hear it on my Apple TV>..

  • [SOLVED] Trying to make command into bash alias

    Here is a command I would like to make into an easy to use bash alias:
    #Copy results of a find to somewhere
    find -iname "*something*" -exec cp '{}' /path/to/copy/results/to \;
    I realize there are usually several ways to do something in the shell, so if a better way of course I'm all for any tips but if I wanted to make this an alias so that I just had to do:
    alias pattern pathtocopyto
    How would I? I have tried:
    alias findcp="find -iname "$1" -exec cp '{}' $2/ \;"
    But this does not work, says it cannot find the search term when I ran it in a test dir full of properly named files and dirs.
    TIA for any help
    Last edited by colbert (2008-12-17 23:19:09)

    Hmm, I tried that Procyon, I could see the HD light on the case go solid so it was running the find but it did not work. I have a file called "layla.mp3" and a dir called "test" in the current dir, ran it like this:
    findcp layla test
    Gave no result and test was still empty Thanks for the help guys hopefully can get this to go..

  • Which program would work best to make a mp4 playable on a dvd player?

    I am trying to convert a video that I shot from a mp4 into something that would be playable on any dvd or blueray player.
    Any help, suggestions or tips are appreciated.

    Since you are asking in the Cloud forum, I will presume you have a 64bit computer that will run Premiere Pro
    CS5-thru-CC PPro/Encore tutorial list http://forums.adobe.com/thread/1448923 will help
    The bottom section of the link above has several Adobe links, and other information, on downloading Premiere Pro CS6 and the bundled Encore CS6, and the TWO ADDED downloads for the Encore library content, to author a DVD or BluRay... and the tutorial list includes learning how to use Encore... pay particular attention to the picture in reply 3 at this link - https://forums.adobe.com/thread/1516173

  • Opens/ program runs and minimzes maximizes and closes, yet every other part if the program doesnt work

    i can open/ run firefox. it can be maximized or resized no problem. links on desktop will open. yet when i go to click on the search bar, or on anything the main frame is un responsive. i have reinstalled previous versions and the most resent. nothing fixes the problem. i love using firefox and tend to have little to no problems. to recap. it starts up, can be resized or close, yet nothing not even the help button can be clicked. what can i do? does this mean i need to use opera or ie to access the internet now. oh nooooo.

    how i fixed this problem:
    -uninstalled/ reinstalled Firefox 16.0.1 twice (problem was still there)
    -uninstalled Firefox and checked off remove personal settings/ bookmarks
    -used cell to download previous Firefox 15.0.1 (USB transferred .exe to desktop)
    -then i cleared my %temp% + my recycle bin
    -ran (one by one) AdAware + McAfee + TrendMicro Housecall virus
    software
    -i then purposelessly hard crashed laptop twice during boot
    -ran boot recovery
    -ran (one by one) disk clean up + disk defrag
    -rebooted
    -reinstalled Firefox 15.0.1 (aka older version) (checked and saw it worked)
    -rebooted
    it took 7 hours to fix (i was playing games on another console half the time). as it is all works fine, again. some bookmarks still missing (on the weekend i weekly/bi-weekly backup bookmarks). oh well atleast i can still use Firefox. i think the problem was due to a theme that 16.0.1 couldn't properly run, so it corrupted the whole program interface. geek power geek love.

  • Lsnrctl services doesnt works, how to make it works

    Hello everyone,
    i got a problem here, i couldn't start listener, then i couldnt start the oracle console...
    how could i solve this ?
    i got no output for :
    *# lsnrctl status*
    *# lsnrctl services*
    *# emca -config dbcontrol db -repos recreate*
    STARTED EMCA at Apr 5, 2012 1:19:21 PM
    EM Configuration Assistant, Version 10.2.0.1.0 Production
    Copyright (c) 2003, 2005, Oracle. All rights reserved.
    Enter the following information:
    Database SID: bill
    Listener port number: 1521
    Password for SYS user: oracle
    Password for DBSNMP user: oracle
    Password for SYSMAN user: oracle
    Email address for notifications (optional):
    Outgoing Mail (SMTP) server for notifications (optional):
    You have specified the following settings
    Database ORACLE_HOME ................ /oracle/product/102
    Database hostname ................ rx3600
    Listener port number ................ 1521
    Database SID ................ bill
    Email address for notifications ...............
    Outgoing Mail (SMTP) server for notifications ...............
    Do you wish to continue? [yes(Y)/no(N)]: y
    Apr 5, 2012 1:19:58 PM oracle.sysman.emcp.EMConfig perform
    INFO: This operation is being logged at /oracle/product/102/cfgtoollogs/emca/bill/emca_2012-04-05_01-19-21-PM.log.
    Apr 5, 2012 1:20:00 PM oracle.sysman.emcp.EMReposConfig dropRepository
    INFO: Dropping the EM repository (this may take a while) ...
    Apr 5, 2012 1:20:00 PM oracle.sysman.emcp.util.PlatformInterface executeCommand
    WARNING: Error executing /oracle/product/102/sysman/admin/emdrep/bin/RepManager -connect (DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=rx3600)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=bill))) -repos_user SYSMAN -action drop -verbose -output_file /oracle/product/102/cfgtoollogs/emca/bill/emca_repos_drop_2012-04-05_01-20-00-PM.log
    Apr 5, 2012 1:20:00 PM oracle.sysman.emcp.EMReposConfig invoke
    SEVERE: Error dropping the repository
    Apr 5, 2012 1:20:00 PM oracle.sysman.emcp.EMReposConfig invoke
    INFO: Refer to the log file at /oracle/product/102/cfgtoollogs/emca/bill/emca_repos_drop_<date>.log for more details.
    Apr 5, 2012 1:20:00 PM oracle.sysman.emcp.EMConfig perform
    SEVERE: Error dropping the repository
    Refer to the log file at /oracle/product/102/cfgtoollogs/emca/bill/emca_2012-04-05_01-19-21-PM.log for more details.
    Could not complete the configuration. Refer to the log file at /oracle/product/102/cfgtoollogs/emca/bill/emca_2012-04-05_01-19-21-PM.log for more details.
    *# $ORACLE_HOME/agent/bin/emctl start agent*
    sh: /oracle/product/102/agent/bin/emctl: not found.
    *# emctl start dbconsole*
    OC4J Configuration issue. /oracle/product/102/oc4j/j2ee/OC4J_DBConsole_rx3600_bill not found.
    *# ./emctl status dbconsole*
    OC4J Configuration issue. /oracle/product/102/oc4j/j2ee/OC4J_DBConsole_rx3600_bill not found.
    *# ./emctl status agent*
    EM Configuration issue. /oracle/product/102/rx3600_bill not found.
    THANK YOU
    Edited by: hael on 5 avr. 2012 07:48
    Edited by: hael on 5 avr. 2012 07:51

    >
    INFO: Dropping the EM repository (this may take a while) ...
    Apr 5, 2012 1:20:00 PM oracle.sysman.emcp.util.PlatformInterface executeCommand
    WARNING: Error executing /oracle/product/102/sysman/admin/emdrep/bin/RepManager -connect (DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=rx3600)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=bill))) -repos_user SYSMAN -action drop -verbose -output_file /oracle/product/102/cfgtoollogs/emca/bill/emca_repos_drop_2012-04-05_01-20-00-PM.log
    Apr 5, 2012 1:20:00 PM oracle.sysman.emcp.EMReposConfig invoke
    SEVERE: Error dropping the repository
    Apr 5, 2012 1:20:00 PM oracle.sysman.emcp.EMReposConfig invoke
    INFO: Refer to the log file at /oracle/product/102/cfgtoollogs/emca/bill/emca_repos_drop_<date>.log for more details.
    Apr 5, 2012 1:20:00 PM oracle.sysman.emcp.EMConfig perform
    SEVERE: Error dropping the repository
    Refer to the log file at /oracle/product/102/cfgtoollogs/emca/bill/emca_2012-04-05_01-19-21-PM.log for more details.
    Could not complete the configuration. Refer to the log file at /oracle/product/102/cfgtoollogs/emca/bill/emca_2012-04-05_01-19-21-PM.log for more details.
    >
    emca failed to drop the repository, and DB control was not successfully configured. Make sure that there is a listener running for this database.
    To start the listener (with the default listener name):
    $<DATABASE_HOME>/bin/lsnrctl start
    Should you need to drop and recreate DB control, refer to Support note 278100.1.
    Regards,
    - Loc
    Edited by: Loc Nhan on Apr 5, 2012 4:09 PM

  • Why this program doesnt work... what it supposed to do

    import java.io.*;
    public class try1 {
         public static void main(String[]args)throws Exception
              BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
              double int1=1;
              double int2=1;
              double int3=1;
              double x=0;
              System.out.println("Euclids Instruction");
              System.out.println(" ");
              System.out.println("Enter 1st:");
              int1=Integer.parseInt(br.readLine());
              System.out.println("Enter 2nd:");
              int2=Integer.parseInt(br.readLine());
              int3 = int1 - int2;
              System.out.print("Series:");
              System.out.print(int3);
              do
                   if (int2>int3)
                        int1=int2;
                        int2=int3;
                   int3 = int1 - int2;
                   x=int3;
                   System.out.print(" " + int3);
                   else if(int2<int3)
                        int1=int3;
                   int3 = int1 - int2;
                   x=int3;
                   System.out.println(" " + int3);
              while (x<0);
              System.out.println("GFC" + " " + int3);
    IT SHOULD BE LIKE THIS
    sample is
    first input is 100
    sec input is 70
    series 30 40 10
    GFC should be 10
    but out put is 30 40
    GFC 40
    it doesnt follow the while int3==0
    please help

    import java.io.*;
    public class try1 {
    public static void main(String[]args)throws Exception
    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    double int1=1;
    double int2=1;
    double int3=1;
    double x=0;
    System.out.println("Euclids Instruction");
    System.out.println(" ");
    System.out.println("Enter 1st:");
    int1=Integer.parseInt(br.readLine());
    System.out.println("Enter 2nd:");
    int2=Integer.parseInt(br.readLine());
    int3 = int1 - int2;
    System.out.print("Series:");
    System.out.print(int3);
    do
    if (int2>int3)
    int1=int2;
    int2=int3;
    int3 = int1 - int2;
    x=int3;
    System.out.print(" " + int3);
    else if(int2<int3)
    int1=int3;
    int3 = int1 - int2;
    x=int3;
    System.out.println(" " + int3);
    while (x<0);
    System.out.println("GFC" + " " + int3);
    FIRST YOU HAVE TO ENTER 2 INPUTS
    THE FIRST INPUT("INT1") IS SUBTRACTED FROM THE SECOND INPUT("INT2") THE OUTPUT WILL BE THE THIRD VARIABLE WHICH IS "INT3"
    THE SYSTEM WILL THEN CHOOSE FROM INT2 OR INT 3 IF WHO'S GREATER OR LARGER
    IF THE SYSTEM DETECTS THAT INT2 IS LARGER THAN INT3 THEN INT1=INT2 AND INT2=INT3
    ELSE IF THE INT3 IS GREATER THEN INT3 WILL BE THEN INT1=INT3 AND INT2 WILL REMAIN THE SAME
    UNTIL IT REACH THE CONDITION INT3==0
    SAMPLE OUTPUT SHOULD BE
    <INPUT 1ST>10
    <INPUT 2ND>2
    OUTPUT SHOULD BE IN
    SERIES LIKE 8 6 2
    GFC IS 2
    BUT WHATS HAPPENING IS IT PRINTS 8 AND 6 .. AND THE GFC IS 6 ...
    ERRR DID I EXPLAIN IT RIGHT?

  • How to WRITE a work area of type GLPCT into a list in ECC6.0?

    Hi,
    I need to wirte a workarea of type glpct as output in the list in ECC6.0. I dont want to include all the 105 fields in the structure in the WRITE statement. Please find the sample code (errored) below.I need your valuable suggestions to simplify this case.
    Note :  (In ECC6.0 it is not allowing us to write the structured workarea directly on the list.)
    DATA : wa_glpct TYPE glpct,
               wa_str TYPE string.
    SELECT * FROM glpct INTO wa_glpct UP TO 1 ROWS.
    MOVE wa_glpct TO wa_str.
    ENDSELECT.
    IF sy-subrc EQ 0.
    WRITE : wa_str.
    ENDIF.

    Hi,
    "WA_STR" and "WA_GLPCT" are not mutually convertible in a Unicode program."
    i.e Both workarea structure must be same when we r using MOVE statement..
    so use the field symbols?
    FIELD-SYMBOLS: <f1> TYPE ANY.
    ASSIGN wa_glpct TO <f1>.
    Try this....
    DATA : wa_glpct LIKE glpct.
    FIELD-SYMBOLS: <f1> TYPE ANY.
    ASSIGN wa_glpct TO <f1>.
    SELECT * FROM glpct INTO wa_glpct UP TO 1 ROWS.
    ENDSELECT.
    IF sy-subrc EQ 0.
    WRITE : / <f1>.
    ENDIF.
    Edited by: Upender Verma on Feb 16, 2009 9:25 AM

  • How to read a file and save the contents into array list

    i have textfile contains information like:
    Name: James Smith
    Customer no: 663,282
    Post code: BA1 74E
    Telephone no: 028-372632
    Last modified: Feb 10, 2008 6:50:00 PM GMT
    Name: Janet Smith
    Customer no: 663,283
    Post code: BA1 74E
    Telephone no: 028-372632
    Last modified: Jan 11, 2007 8:10:05 PM GMT
    etc...
    how can i read the contents of this textfile and put the data into an ArrayList called ArrayList<Customer> customerList.
    i knew that i need two classes, one for CustomerDetails and one for ReadFile.
    i have already done the customer class as:
    import java.util.Date;
    public class Customer
        String Name;
        int CustomerNo;
        String Postcode;
        String teleNo;
        Date lastModified;
        public Customer(String Name, int CustomerNo, String Postcode, String teleNo, Date lastModified)
         assign(Name, CustomerNo, Postcode, teleNo, lastModified);
        public void assign(String Name, int CustomerNo, String Postcode, String teleNo, Date lastModified)
         this.Name=Name;
         this.CustomerNo=CustomerNo;
         this.Postcode=Postcode;
         this.teleNo=teleNo;
         this.lastModified=lastModified;
        public String toString()
         String allDetails = "Name: "+Name+
             ", Customer No: "+CustomerNo+
             ", Postcode:"+Postcode+
             ", Telephone No: "+teleNo+
             ", Last Modified Date: "+lastModified;
         return allDetails;
    }i just wondering how can i code the ReadFile class?
    can anyone help me please. thank you in advance.

    thank you for your suggestion, but i have already started to code the readCustomer class using the Scanner.
    the code i got so far is:
    import java.util.Scanner;
    import java.io.*;
    public class readCustomer
        public static void main(String[] args)
         readCustomer("Customers.txt");
        public static void readCustomer(String filename)
         try {
             Scanner scanner = new Scanner(new File(filename));
             scanner.useDelimiter(System.getProperty("line.separator"));
             while (scanner.hasNext()) {
              processLine(scanner.next());
             scanner.close();
         } catch (FileNotFoundException e) {
             e.printStackTrace();
        public static void processLine(String line)
         Scanner scanner2 = new Scanner(line);
         scanner2.useDelimiter("\\s*:\\s*");
         String description = scanner2.next();
    *// here is where i am struggling. i don't know how to get the information after the : sign*   
    }i am currently struggling with the processLine method?
    also, i am not sure how to group a set of information and put them into the arraylist.
    Any hint, please. Thank you.
    Edited by: mujingyue on Feb 26, 2008 12:42 PM

  • It doesnt work

    I have had my ipod for about a year i listen to it very often. It holds a good battery charge. The other day i was listening and the battery was low then it died and showed a funny sign that i had never seen before. It looked like a battery with a lighting bolt next to it. And now it will not turn on. I have tried resetting it and that doesnt work. I plugged it into the compuetr and that doesnt work i charged i too. the computer doesnt even recognize it. help me please i live off of my ipod help!!!

    I'm a long ways from being an expert, but it sounds to me like your battery won't hold a charge anymore. Try getting a new battery.

  • Password to unlock backup doesnt work - changed passwords and still not accepting - suggestions?

    Password to unlock iphone backup doesnt work, tried new password and still nothing, any suggestions/help?

    If you don't know the password for your encrypted backup, it can no longer be used.  The whole point of encryption is lost if the password can be circumvented.
    Your only choice now is to disable backup encryption and create a new backup. If you need to encrypt the new backup - re-enable encryption and DO NOT LOSE THE PASSWORD.
    iTunes: About iOS backups

  • I updated to MAvericks and my double click on the trackpad doesnt work

    I updated to MAvericks and my double click on the trackpad doesnt work.
    Also the spotlight feature doesnt work either, it makes a sound everytime i click on it.
    please help.
    Thank you!
    fxm

    Did you make a clean install and restore the library from a backup?  No.  
    Or did you install the new system amd new version on top of the old system?  Yes.
    What version did you upgrade from? 3.4
    Is your Aperture library onyour internal drive or also on an external drive? External
    During the update, has your Aperture library been moved in any way? No, its still where it was on the external drive.
    Thanks for your help.  Ideas?

  • Command Link with Datatable doesnt work

    I had read the previosu posts stating that commandLink with the datatable will be corrected with the new version of Jsf- 1_1_01 .I installed the new version and the commandLink doesnt work inside a datatable still

    try initialising the List attached to the dataTable
    in the constructor or use an outputLink
    -DevioutputLink is similar to <href in jsp.It cannot implement the actionListener and action parameters which a commandLink does. Using a constructor for initializing is fine but when i want it to implement certain method then it creates a problem.

  • HT200169 Having a problem with Logic 9 on a Mac Pro.Working on a lenghty song and apparently session got corrupted.Doesnt let me export tracks,program crashes.Already tried start brand new session with the tracks imported into it but still wont export.Sug

    Hello,having a problem with Logic 9 on a Mac Pro.Working on a lenghty song and apparently session got corrupted.Doesnt let me export tracks,program crashes.Already tried start brand new session with the tracks imported into it but still wont export.Suggestions?

    Thanks, Ian. Yeah, that's how I do it now...or with the controls in the left side pane. Still, I would have liked that quick on-the-spot edit capability...especially while sketching.
    Ian Turner wrote:
    Sorry Mark, you are out of luck as it does not do that - it works the same as L8. The way I would achieve that with more accuracy and control would be to route all the tracks you want to fade to a Bus then use volume automation on the bus. To do this you will need to add a standard audio track, then re-assign it using (Control Click on the track header) to the Bus track. You can then automate volume/plugins etc on the Bus track.
    Ian

Maybe you are looking for

  • AD integration, making AD groups members of OD groups

    Hello everyone! I have a 10.4.8 server bound to AD. It is an OD master. On order to define Mac OS X preferences for my users/client computers, I need to work with OD groups. So I create a new OD group, and grab the appropriate AD user groups and make

  • How to put iTunes content on one drive, everything else on another

    I have had an original Pro since '06. It doesn't run Mav, so I popped for the new one. Oddly enough, the price was exactly the same once inflation was considered. Thank you Canadian Petrodollars! Anyway... on my old machine I had an SSD called Fast w

  • Field separator in TEXT_CONVERT_TO_XLS_SAP

    Hi all what is the purpose of field separator in FM TEXT_CONVERT_TO_XLS_SAP.what are the possible values to be given for that field separator??????? what values do i have to give for tab limited points will be rewarded

  • How can we hide the link "Attachment" in the preview of a Task??

    Hi all I have requirement in portal CE 7.1 as follows. all GP tasks are getting displayed in UWL that is fine. i want to hide the link "Attachment" in the preview of a Task?? once i open the task from UWL then that task item opens in new window where

  • TC + Airport with Windows Vista

    For Xmas, I purchased a refurb Time capsule which works flawlessly with my iMac 3.0 Gz intel core duo with Mac OS X 10.6.2. It allows my Windows Laptop running Vista to connect as a "guest." I would like to have my Vista machine be part of the networ