Java Intro student needs help on arrays

As my first assignment I have created a program called RobotRat which has a "Rat" move north, south, east, or west on an array floor. I have the program running but am having trouble creating my "floor" using a two-dimensional array. My teacher also wants us to use boolean values for our array. I am drawing a blank on how to create this. From my books I have gathered the following code but cannot get it to work. Any help would be greatly appreciated:
1.public class RobotRatArray
2.{
3.
4. dataType RobotRatArray[] [];
5. int matrix [] [];
6. matrix = new int [20] [20];
7.
8.
9.}

Okay, I just spoke with a classmate of mine and they said my array isn't in another window. I need to do some system.out.print commands so they print out on my dos window. I am just so confused with this program. I am going to copy and paste it in here in case anyone has any guidance for me. It would be greatly appreciated. (Sorry, I can't figure out how to get my line numbers to populate from textpad when I paste in this message)
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
public class RobotRat extends JFrame implements ActionListener
     private JPanel panel1 = null;
     private JPanel panel2 = null;
     private JPanel panel3 = null;
     private JLabel label1 = null;
     private JLabel label2 = null;
     private JLabel label3 = null;
     private JTextField textfield1 = null;
     private JButton button1 = null;
     private JButton button2 = null;
     private JButton button3 = null;
     private JButton button4 = null;
     private boolean[][] floor = null;
     private int current_column = 21;
     private int current_row = 21;
     private static final int UP = 1;
     private static final int DOWN = 0;
     private static final int NORTH = 0;
     private static final int EAST = 1;
     private static final int SOUTH = 2;
     private static final int WEST = 3;
     private int pen_position = UP;
     private int rats_direction = EAST;
public RobotRat()
super("RobotRat");
label1 = new JLabel("Spaces: ");
textfield1 = new JTextField(40);
button1 = new JButton("Move North");
button2 = new JButton("Move South");
button3 = new JButton("Move East");
button4 = new JButton("Move West");
button1.addActionListener(this);
button2.addActionListener(this);
button3.addActionListener(this);
button4.addActionListener(this);
this.getContentPane().setLayout(new FlowLayout());
this.getContentPane().add(label1);
this.getContentPane().add(textfield1);
this.getContentPane().add(button1);
this.getContentPane().add(button2);
this.getContentPane().add(button3);
this.getContentPane().add(button4);
this.setSize(600, 100);
this.setLocation(100, 100);
this.show();
public void togglePen()
     switch(pen_position)
          case (UP): pen_position = DOWN;
          label1.setText("DOWN");
          break;
          case (DOWN): pen_position = UP;
          label1.setText("UP");
          break;
          default: break;
public void turnLeft()
     switch(rats_direction)
          case NORTH: rats_direction = WEST;
          label3.setText("WEST");
          break;
          case EAST: rats_direction = NORTH;
          label3.setText("NORTH");
          break;
          case SOUTH: rats_direction = EAST;
          label3.setText("EAST");
          break;
          case WEST: rats_direction = SOUTH;
          label3.setText("SOUTH");
          break;
public void move()
     int spaces_to_move = 0;
     try
          spaces_to_move=Integer.parseInt(textfield1.getText());
     catch(Exception e)
     switch(pen_position)
          case UP:
               switch(rats_direction)
                    case NORTH: ;
                    case SOUTH: ;
                    case WEST: ;
                    case EAST: ;
          break;
          case DOWN:
               switch(rats_direction)
                    case NORTH: ;
                    case SOUTH: ;
                    case WEST: ;
                    case EAST: ;
          break;
public void actionPerformed(ActionEvent e)
     if (e.getActionCommand().equals("TogglePen")) {
     togglePen();
     else if (e.getActionCommand().equals("TurnLeft")) {
     turnLeft();
public static void main(String[] args)
     RobotRat rr = new RobotRat();

Similar Messages

  • Intro To Java Programming student needing help on how to download java SDK on 10.6.8

    Hey Ladies and Gents,
    For the past hour I have been trying to download Java SDK for my 10.6.8 Mac. Can someone point me in the right direction. I am taking a course in intro to Java programming and the book I am using isnt as helpful as I hoped.

    SE 6 development kits support SE 5 constructs.  Just watch that you use only SE 5 constructs.  Texts on 5 will not list the 6 constructs, and texts on 6 are available that tell what came when.
    There is another forum (https://discussions.apple.com/community/developer_forums) where "developers" troll for questions to answer, and your developer questions will stay at the top of the list longer than in MacbookPro forum.

  • New Java Programming Student Needs Help

    Hey everyone,
    I've just started taking a Java programming class at Penn State University, and I have had some prior experience with programming, i.e. C, C++, HTML, SQL. However, this will be my first attempt at Java. I know there are a lot of similarities between C++ and Java, but I'm still a little lost on some methodology.
    To get myself going, I've been looking through the textbook a little and came across a problem that gave me some difficulty. I'll write out the outline:
    A company pays its employees as managers (who receive a fixed weekly salary), hourly workers (who receive a fixed hourly wage for up to the first 40 hours they work and time and a half (i.e. 1.5 times their hourly wage) for overtime hours worked, commission workers (who receive $250 plus 5.7% of their gross weekly sales), and pieceworkers (who receive a fixed amount of money per item for each of the items they produce � each pieceworker in this company works on only one type of item).
    +Define a Java class named EmployeePayment that includes functionality to compute the weekly pay for each employee. You do not know the number of employees in advance. Each type of employee has its own pay code: Managers have paycode 1, hourly workers have paycode 2, commission workers have paycode 3 and pieceworkers have paycode 4.+
    +Define a main method that creates an instance of the EmployeePayment class, and calls the setManagerPay method to set the managers weekly salary to $625.00. The main method should then prompt the user for the paycode ��Enter paycode (-1 to end): �, validate the input and perform the associated processing for that paycode. Your program should allow the user to process employees until a paycode of -1 has been entered. Use a switch structure to compute each employee�s pay, based on the employee�s paycode. Within the switch, prompt the user (i.e. the payroll clerk) to enter the appropriate facts your program needs to calculate each employee�s pay based on that employee�s paycode, invoke the respective method (defined below) to perform the calculations and return the weekly pay for each type of employee, and print the returned weekly pay for each employee.+
    +Define a setManagerPay method that accepts and stores the fixed weekly salary value for managers.+
    +A private instance variable weeklyManagerPay should be defined in the EmployeePayment class to support these accessor and mutator methods.+
    +Define a calcManagerPay method that has no parameters and returns the fixed weekly salary.+
    +Define a calcHourlyWorkerPay method that accepts the hourly salary and total hours worked as input parameters and returns the weekly pay based on the hourly worker pay code description.+
    +Define a calcCommWorkerPay method that accepts the gross weekly sales as an input parameter and returns the weekly pay based on the commission worker pay code description.+
    +Define a calcPieceWorkerPay method that accepts the number of pieces and wage per piece as input parameters and returns the weekly pay based on the piece worker pay code description.+
    +Once all workers have been processed, the total number of each type of employee processed should be printed. Define and manage the following private instance variables (*numManager*, numHourlyWorker, numCommWorker, and numPieceWorker) within the EmployeePayment class. What are the ways in which these variables can be updated?+
    Sorry for the length, but I wanted this to be thorough. Basically, I'm having the most trouble writing the switch statement, and outputting the total number of each type of employee...
    Any help and pointers will be greatly appreciated...thanks all.

    You said you've written C and C++ code before. I don't have an excellent memory but from the little code that I wrote in C, I believe the switch statement is exactly the same.
    Read this: [http://java.sun.com/docs/books/tutorial/java/nutsandbolts/switch.html]
    If you're having trouble understanding something post what your specific problem is. No one is going to write your homework for you, but many, myself included, would be more than willing to help if you're really stumped. Just post your concise problem.
    Edited by: sheky on Mar 12, 2008 9:52 PM

  • Need help for array counting

    Any help for array question
    Hello to All:
    I want to tally or count some of the elements that I have in array but not sure how.
    I have for example: int myArray[] = {90,93,80,81,71,72,73,74};My objective is to tally all of the 90's, tally all of the 80's and tally all of the 70's.
    So, the result that I want to have would look something like the following:
    System.out.println ("The total tally number of 90's is " 2 );
    System.out.println ("The total tally number of 80's is " 2 );
    System.out.println ("The total tally number of 70's is " 4 );I do not want to add these numbers, just want to count them.
    Also I want to use a "forloop" to achieve the result intead of just declaring it at 2 or 4 etc..
    Any help Thankyou

    [u]First , This is not exactly what I have to
    do for homework. There is a lot more, a lot more
    involved with the program that I am working on.
    Second, this is an example, an example, an
    example of something that I need to achieve.
    Third, you are asking for a code, to me that
    sounds as if your asking for homework. Fourth,
    I did not ask for any rude comments. Fith, in
    the future please do not reply to my messages at ALL
    if you can not help!!!!
    Sixth, We did not ask for lazy goofs to post here.
    Seventh, In the future please do not post here. Take a hike - there's the virtual door.

  • Need help: merge array

    Hi everybody
    Need help in merging array of strong edges (coordinates).
    Already using array in 'if else' but have problem in merging those sequence values into two arrays of x and y coordinates (it will take all coordinates in image).
    Any ideas?
    Thanks.
    mySiti
    for (int i = 0; i < width; i++) { //for width
                for (int j = 0; j < height; j++) { //for height
                    Color c = pic.get(i, j);
                    int r = c.getRed();
                    int g = c.getGreen();
                    int b = c.getBlue();
                   int finalEdgeR=0, finalEdgeG=0, finalEdgeB=0;
                   int notEdgeR, notEdgeG, notEdgeB;
                   int [] StrongEdgeCoordX = new int ;
    int [] StrongEdgeCoordY = new int [j];
    if(r>=50 && r<=255)
    finalEdgeR=r;
    System.out.println("--------------------------------");
    System.out.println("coordinate of this pixel '"+i+"'");
    System.out.println("coordinate of this pixel '"+j+"'");
    System.out.println("StrongEdgeCoordX '"+i+"'");
    System.out.println("StrongEdgeCoordY '"+j+"'");
    System.out.println("edge red '"+finalEdgeR+"'");
    else if (r>=0 && r<50) notEdgeR=0;
    if(g>=50 && g<=255)
    finalEdgeG=g;
    System.out.println("edge green '"+finalEdgeG+"'");
    else if (g>=0 && g<50) notEdgeG=0;
    if(b>=50 && b<=255)
    finalEdgeB=b;
    System.out.println("edge blue '"+finalEdgeB+"'");
    else if (b>=0 && b<50) notEdgeB=0;

    hi, i have here a codes but i dont know on how to print the value that stored in array C;
    heres the sample code;
    // your array a and b
    int[] a, b;
    // you fill them
    a = ...;
    b = ...;
    // now you merge them
    int cSize = a.length + b.length;
    int[] c = new int[cSize];
    // pos of the c array
    int count = 0;
    int i = 0;
    for(i = 0; i < a.length; i++){
    c[count++] = a;
    for(i = 0; i < b.length; i++){
    c[count++] = b[i];

  • Java not working, need help from the pros!!!

    Whenever i go to a website that uses java (like runescape), the window that has the java is all white screen and on the top left side there is a little sheet of paper with a folded corner with a red X on it.
    Java doesn't work, please i need help!
    i am sure i have the current version
    i think it may have something to do with a failed classloader (maybe)

    when i click on the red X, and go java consol, this is that appears:
    +Java Plug-in 1.5.0+
    +Using JRE version 1.5.0_13 Java HotSpot(TM) Client VM+
    +User home directory = /Users/***********+
    +c: clear console window+
    +f: finalize objects on finalization queue+
    +g: garbage collect+
    +h: display this help message+
    +l: dump classloader list+
    +m: print memory usage+
    +o: trigger logging+
    +p: reload proxy configuration+
    +q: hide console+
    +r: reload policy configuration+
    +s: dump system and deployment properties+
    +t: dump thread list+
    +v: dump thread stack+
    +x: clear classloader cache+
    +0-5: set trace level to <n>+

  • Im a newbie in java and i need help. im a student

    im an I.T student in Adamson University here in the philippines i went here to ask help about our activity in school about java. our professor told us to make a program in java (btw were using netbeans) that will ask the user his birth year and then the output will tell the zodiac sign of the year entered. she told us (our prof) to make it using showInputDialog. and then to show the output we must use the JOptionPane.showMessageDialog.
    i try to do it but i found myself in trouble bcoz im new in java.
    i try to to it and here's what i did
    import javax.swing.JOptionPane;
    public class Zodiac;
    public static void main(String args[])
    String name=JOptionPane.showInputDialog("Enter your year of birth?");
    String message=String.format("Your zodiac sign is tiger");
    JOptionPane.showMessageDialog(null,message);
    i knew that i need to use conditional statements here but i dont know where to put it and how to declare the JOptionPane.etc.
    pls help me asap im a newbie.

    as you wish heres what i did. this is not a gui version
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package marlonestipona;
    * @author ESTIPONA
    import java.util.Scanner;
    public class Main {
    public static void main(String[] args) {
    Scanner input = new Scanner(System.in);
    int yr1;
    String tgr ="Tiger";
    String dog ="Dog";
    String rbt ="Rabbit";
    String ox ="Ox";
    String drgn ="Dragon";
    String rat ="Rat";
    String pig ="Pig";
    String rst ="Rooster";
    String hrs ="Horse";
    String shp ="Sheep";
    String mky ="Monkey";
    String snk ="Snake";
    System.out.print("Enter your birth year: ");
    yr1=input.nextInt();
    if (yr1==1974 || yr1==1986 || yr1==1998)
    System.out.printf("Your zodiac sign is %s!\n",tgr);
    }else if (yr1==1982 || yr1==1994 || yr1==2006){
    System.out.printf("Your zodiac sign is %s!\n",dog);
    }else if (yr1==1975 || yr1==1987 || yr1==1999){
    System.out.printf("Your zodiac sign is %s!\n",rbt);
    }else if (yr1==1973 || yr1==1985 || yr1==1997){
    System.out.printf("Your zodiac sign is %s!\n",ox);
    }else if (yr1==1976 || yr1==1988 || yr1==2000){
    System.out.printf("Your zodiac sign is %s!\n",drgn);
    }else if (yr1==1972 || yr1==1984 || yr1==1996){
    System.out.printf("Your zodiac sign is %s!\n",rat);
    }else if (yr1==1983 || yr1==1995 || yr1==2007){
    System.out.printf("Your zodiac sign is %s!\n",pig);
    }else if (yr1==1981 || yr1==1993 || yr1==2005){
    System.out.printf("Your zodiac sign is %s!\n",rst);
    }else if (yr1==1978 || yr1==1990 || yr1==2000){
    System.out.printf("Your zodiac sign is %s!\n",hrs);
    }else if (yr1==1971 || yr1==1991 || yr1==2003){
    System.out.printf("Your zodiac sign is %s!\n",shp);
    }else if (yr1==1980 || yr1==1992 || yr1==2004){
    System.out.printf("Your zodiac sign is %s!\n",mky);
    }else if (yr1==1977 || yr1==1989 || yr1==2001){
    System.out.printf("Your zodiac sign is %s!\n",snk);
    } else
    System.out.println("Invalid");
    now my problem is how to turn this whole code into gui using those dialog boxes.

  • First Java Programming Assignment - Grad student needs Help

    Thank-you to whomever helps me out here (I have been waiting for the Professor to respond for 2 days now, and our asignment is due by midnight 2-nite. Here is my problem. We have a value called nPer. This value is defined as a double (it needs to since, it perfoms lots of calculations). Now the assigment calls for the print line to display the field in its integer format. So I have done the following:
    nPer=Math.ceil(nPer);
    This has caused the value to be represented as 181.0. Not good enough! The value needs to be truncated and represented as 181.
    The professor has provided us with directions that use the following syntax
    (int)181.0
    Putting that exact code in my program causes JBuilder to create an error message. Ergo, its not right. I have serached all over the tutorial looking for the proper method to resolve this, however - no luck. Could some kind sole please help??? Thank-you.

    You can look at either java.math.BigDecimal, if the
    true representation of the value and rounding are a
    concern, or java.text.NumberFormat if it's simply a
    matter of display.
    Your professor must be an old C programmer. Casting a
    double to an int? Oh, my. - MODBut that's what his assignment says, display it as an int. And the cast would work; I'm assuming he just didn't use it right.

  • Im a Uni student&need help:JAVA Final Year Project: Undo Manager Problem

    Hey all,
    Im writing a Final Year Project and have minimal experience writing in JAVA.
    It is an information visualisation assignment which involves reproducing code/text in a reduced format. Sort of to do with Line oriented statistics.
    http://www.cc.gatech.edu/aristotle/Tools/tarantula/continuous.gif
    This image will give you an idea of what im talking about.
    Anyway, i need to know if its possible to get information about individual undos/edits from an undomanager.
    Basically i need to be able to say, for example,
    there are 12 undos
    undo 12 occurs at line X
    undo 11 occurs at line Y
    etc etc
    I need to be able to get this information without actually invoking the Undo last edit call.
    Im bringing the Java undomanager tutorial home but from what ive read it seems like impossible?
    Any and all help appreciated.
    Regards,
    P

    When I was at uni I had to implement that for the text area of an IDE. All I did was rip off the code from the Notepad.java that comes with the SDK.

  • Collage Students need help with Java project(Email Server) whats analysis?

    Hi im studying in collage at the moment and i have just started learning java this semester, the thing is my teacher just told us to do an project in java , since we just started the course and i dont have any prior knowledge about java i was wondering if some one could help me with the project.
    i choose Email Sevice as my project and we have to submit an analysis and design document , but how the hell am i suppose to know what analysis is ? i just know we use ER diagrams & DFD's in the design phase but i dont know what analysis means ?
    could some one tell me what analysis on an email service might be? and what analysis on a subject means? is it the codeing involved or some thing coz the teacher told us not to do any codeing yet so im completly stumped,
    oh and btw we are a group of 3 students who are asking u the help here coz all of us in our class are stupmed ?

    IN case any one is interested this is the analysis i wrote
    ANALYSIS
    Analysis means figuring out what the problem is, maybe what kinds of solutions might be appropriate
    1.     Introduction:-
    The very definition of analysis is an investigation of the component parts of a whole and their relations in making up the whole. The Analysis done here is for an emailing service called Flashmail, the emailing service is used to send out mails to users registered with our service, these users and there log activities will be stored in some where, the most desirable option at this time is a Database, but this can change as the scope of the project changes.
    2.     Customer Analysis:-
    We are targeting only 30 registered users at the moment but this is subject to change as the scale changes of the project .Each user is going to be entitled to 1MB of storage space at this time since we lack the desired infrastructure to maintain anything higher than 1MB but the end vision of the project is to sustain 1000 MB of storage space while maintaining a optimal bandwidth allocation to each user so as to ensure a high speed of activity and enjoyment for the Customer.
    The Service will empower the user to be able to send, read, reply, and forward emails to there specified locations. Since we are working on a limited budget we can�t not at this time enable the sending of attachments to emails, but that path is also left open by modularity of java language, so we can add that feature when necessary.
    3.     Processor Load Analysis:-
    The number of messages per unit time processing power will be determined on hand with various algorithms, since it is best not to waste processor power with liberally distributing messages per unit time. Hence the number of messages will vary with in proportion to the number of registered users online at any given time.
    4.     Database Decision Analysis:-
    The High level Requirements of the service will have to be decided upon, the details of which can be done when we are implementing the project itself. An example of high level requirements are database management, we have chosen not to opt for flat files because of a number of reasons, first off a flat files are data files that contain records with no structured relationships additional knowledge is required to interpret these files such as the file format properties. The disadvantages associated with flat files are that they are not fast, they can only be read from top to bottom, and usually they have to be read all the way through. Though there is are advantages of Flat files they are that it takes up less space than a structured file. However, it requires the application to have knowledge of how the data is organized within the file.
    Good databases have key advantage over flat files concurrency. When you just read stuff from file it�s easy, but tries to synchronize multiple updates or writes into flat file from scripts that run in different process spaces.
    Whereas a flat file is a relatively simple database system in which each database is contained in a single table. In contrast, relational database systems can use multiple tables to store information, and each table can have a different record format.
    5.     Networking Analysis:-
    Virtually every email sent today is sent using two popular protocols known as SMTP (Simple Mail Transfer Protocol) and MIME (Multipurpose Internet Mail Extensions).
    1.     SMTP (Simple Mail Transfer Protocol)
    The SMTP protocol is the standard used by mail servers for sending and receiving email. In order to send email we will first establish a network connection to our SMTP server. Once you have finished sending your email message it is necessary that you disconnect from the SMTP server
    2.     MIME (Multipurpose Internet Mail Extensions)
    The MIME protocol is the standard used when composing email messages.

  • Java student needs help please.

    I'm a new CS major, I'm having a hell of a time with a java project.
    Write a program to read in a list of nonnegative integers and to ouput the largest integer, smallest interger, an the average of the integers. The end of the input is indicated by the user entering a negative sentinel value.
    Any ideas would be greatly appreciated

    Bobsters wrote:
    well...im sorry to have an attitude. Now...let's move on.
    This is as far as i have gotten.
    import java.util.*;
    public class Project2_1
    public static void(String[] args)
    double largest, smallest, average;
    System.out.println("Enter some nonnegative intergers.");
    System.out.println("Enter a negative integer after you have");
    System.out.println("entered the nonnegative integers.");Is that it? If you're too simple-minded to work out anything more than that, please don't take CS courses. Best advice I can give you is, sign up again with another user name, wait about a week so we've forgotten you, then try again. And mind your manners next time round

  • Need Help for Array with Object

    hey there guys... am trying to complete my project which is to create a Library System. Was able to create a list to show the books available when they select the book and click a borrow button it can print out the book.
    what problem i have now is that when a student click borrow... the value how can i transfer to an array inside the object student.
    i am usin a main screen (ms) who is controlling all the functions. been trying and trying on this for very long hopefully there will be those who are able to help me out.
    my customer screen would be like this... but how can i add in the array for books borrowed
    import javax.swing.*;
    class Customer
         private String name;
         private int accNo;
         private String password;
         private double balance;
         private Books borrow[]=new Books[5];
         int borrowCount=0;
         static int customerCount=0;
         private MainScreen ms;
         Customer(String n, int no, String p, double b)
              name=n;
              accNo=no;
              password=p;
              balance=b;
              customerCount++;
              JOptionPane.showMessageDialog(null,name +" record created");
              display();
    /* Trying to Create the Array to store information
         public void setStudentBorrow(String a)
              borrow[borrowCount]=a;
              borrowCount++;
              JOptionPane.showMessageDialog(null,"Book Borrowed");
         public String getStudentBorrow()
              for(int i=0;i<borrowCount-1;i++)
              {     return borrow;     }
         public String getPassword()
         {     return password;     }
         public String getName()
         {     return name;          }
         public int getAccNo()
         {     return accNo;     }
         public double getBalance()
         {     return balance;     }
         public void setName(String n)
         {     name=n;     }
         public void setPassword(String p)
         {     password=p;     }
         public void setBalance(double b)
         {     balance=b;     }
         public void setAccNo(int no)
         {     accNo=no;     }
         public void display()
              JOptionPane.showMessageDialog(null,
              "\nCutomer Number : "+ customerCount+
              "\nName :"+name+
              "\nAccount Number: "+accNo+
              "\nBalance (RM): "+balance,"Customer record",
              JOptionPane.INFORMATION_MESSAGE     );

    Cross Post:
    http://forum.java.sun.com/thread.jspa?threadID=779224&messageID=4433689#4433689

  • Need Help with Array.sort and compare

    Hi
    I have a big problem, i try to make a java class, where i can open a file and add new words, and to sort them in a right order
    Ok everthing works fine, but i get a problem with lower and upper cases.
    So i need a comparator, i tried everything but i just dont understand it.
    How do i use this with Array.sort??
    I hope someone can help me

    Okay, you want to ignore case when sorting.
    There are two possibilities: Truly ignore case, so that any of the following are possible, and which one you'll actually get is undefined, and may vary depending on, say, which order the words are entered in the first place:
    English english German german
    english English german German
    English english german German
    english English German german
    The second possibility is that you do consider case, but it's of lower priority--it's only considered if the letters are the same. This allows only the first two orderings above.
    Either way, you need to write a comparator, and call an Arrays.sort method that takes both array and Comparator.
    The first situation is simpler. Just get an all upper or lower case copy of the strings, and then compare thosepublic int compare(Object o1, Object o2) {
        String s1 = ((String)o1).toUpper();
        String s2 = ((String)o1).toUpper();
        return s1.compareTo(s2);
    } You'll need to add your own null check if you need one.
    For the second way, your comparator will need to iterate over each pair of characters. If the characters are equal, ignoring case, then you compare them based on case. You pick whether upper is greater or less than lower.
    Of course, the need to do this assumes that such a method doesn't alrady exist. I don't know of one, but I haven't looked.

  • Noob needs help with array manipulation

    First off, I'd like to say hello to eveybody!
    I'm trying to figure out how to search for a value in an array, delete the first occurence of it, and shift the rest of the array down one. Can anyone point me in the right direction of an algorithm, mabey?
    Any help is most appreciated!

    first of all, let me comment that for this purpouse, you're better using the ArrayList class.
    anyway, you would need to make a temporary array inside a method, and traverse the array in question using a loop. most people use a for loop.
    Then, put all the values of the old array into the temporary one, except for the one you dont want.
    after the loop, set the old array to equal the temporary array.

  • Need Help with Arrays/Text

    I'm trying to create a flash program that uses it's own code to send and create images. Each square has a colour and that colour gets added into the array. A black, then grey, then white is:
    filecode = ["Bl", "Gr", "Wh"];
    That works fine, but when I try to paste it into an Input text box it will only fill in the first part of the array.
    filecode = ["Bl,Gr,Wh"];
    So the program has NO idea what I want.
    The only ways I can think of fixing this is by putting in 402 text boxes to suit every box...But every one of them needs a Variable Name.
    Or by sending the information straight into the array. But this way you are just looking at what you just drew, and that is not at ALL practical.
    Helping me with this headache will be greatly apprectiated.
    FlashDrive100.

    If you can explain the first part of your posting it might become a little clearer what you are trying to do and what isn't working... particularly this...
    " when I try to paste it into an Input text box it will only fill in the first part of the array."
    I can't speak for anyone else, but at this point, I share your file's problem... not knowing what you want.

Maybe you are looking for