Arrays or Spreadshee​ts? Help with School Excercise

Hello there, my Control Systems Engineering professor will make us a LabView test in a couple of weeks, although he won't actually teach us the software, but rather we need to get our hands dirty. Anyways, I'm trying to resolve this excercise:
Problem Definition.
On a storage area of a container terminal containers are stored temporarily waiting for further transportation. The location of a specific container along with its code is stored in a database. Whenever the operator types in the code of a container, the according location is shown on the screen.
Demands.
- Take as storing area a rectangle of 3 rows of 4 positions horizontal and 2 positions vertical (24 containers).
- Each containers is identified by a unique alphanumerical code of 11 digits. Digit # 11 is the check digit, being the last digit of the sum of the previous 10 digits based upon the ASCII table.
- When filling the database, the user myst apply the code of the container and its location.
- When searching for a container, the operator applies only the code of the container. On the front panel the according location must be displayed by the program.
- If a container is not found it must be reported by means of an error message.
- If an incorrect container code is inserted it must be reported by means of an error message.
What I've done so far:
I've made a UI and code so that I can type a 11 digit string and the VI will indicate me if its a valid code or not, based in the comparison of the 11th digit.
What I need:
Next step, I believe, is that if the code is valid, I should store it in a database along its position. I know that there is a Database toolkit for LabView, but you must agree it is impractical as this is just an excercise. I was thinking about making an array or a spreadsheet, but have no experience with it. Also it seems that arrays work best with For and While Loops, but I might be wrong... and how can the user assign its position?
Well, thanks all in advance for ANY suggestions. Everything is welcome.
Pohl.

Hello,
Take a look at the following link:
http://zone.ni.com/reference/en-XX/help/371361B-01​/lverror/too_few_format_specifiers/
it explains this error and also gives a link to the format you should use for this function.
Regards,
RikP - National Instruments Applications Engineering
Rik Prins, CLD
Applications Engineering Specialist Northern Europe, National Instruments
Please tip your answer providers with kudos.
Any attached Code is provided As Is. It has not been tested or validated as a product, for use in a deployed application or system,
or for use in hazardous environments. You assume all risks for use of the Code and use of the Code is subject
to the Sample Code License Terms which can be found at: http://ni.com/samplecodelicense

Similar Messages

  • Need a good App to help with School

    I am looking for a good App that I can use to take notes on for college. I will be taking Organic Chemistry and Biochemistry. I want to be able to type in text because I can type must faster than I can write in manuscript, but I also want to be able to use my stylus to draw molecular structures and formulas and reactions and things like that. Does anyone know of a good app for this? Paid of Free, it does not matter! I love using Evernote, however, I haven't found that I can draw in notes.
    Any help is appreciated!!
    Thank you!

    I have Notability, and Pages.  I don't know for sure if you can use the stylus or not in that app. However, Notability is a good one I know you can type in it and can draw/write with it.  As far as writing your notes in it that didn't work as well for me.  This app you can also record the lecture in the same place you take the notes.  I would recomend getting it and playing with it a little before you need it.  I had a little problem with writing on it, because I set my hand on the screen too, it has a cover but that mostly stops you from making lines all over your notes with your hand. So, if you don't need to set your hand down to write then you maybe ok.  It is a good app I like it.  Good luck!

  • Quick Help With School Work

    I am current student that just got into a web design class, I was sent home with some homework seeing what we know and I have a question that I am stumped on .Was wondering if anyone could help me with this question:
    Write an advanced CSS selector that specifically targets the input type or name for the following HTML:
    <input type="text" name="address1" value=""/>
    Thank you very much from web student and indvidual wanting to learn from their peers

    Hi
    As john said it may not be what is required, but as the css attribute selector is css2.1, (and further expanded in css3) I would not expect this to be included in a curriculum at this time.
    CSS2.1 is only supported by the newer browsers and not IE versions < 7.
    But if you wish to be certain you could also include this in your answer see - http://www.w3schools.com/css/css_attribute_selectors.asp. For full reference you could also point your tutor to - http://www.w3.org/TR/css3-selectors/.
    PZ

  • Help with sparse matrix

    I need to create a sparse matrix implementation. Only allocate space for non-zero matrix elements. Implement methods for addition, subtraction, multiplication and determinant. Here is how I want to implement it:
    Matrix is an array of linked lists.
    Each linked list represents a row.
    Each entry in the linked list has a value and a column associated with it.
    I need help with the setEntry method and creating the array of linked lists.
    Here is what I have so far:
    import java.io.*;
    import java.util.*;
    public class Matrix
      private int numberOfRows;
      int numberOfColumns;
      private IntegerNode[][] entries;
      private IntegerNode head = null;
      private static BufferedReader stdin = new BufferedReader(
                 new InputStreamReader( System.in ) );
      // Constructor
      public Matrix(int numberOfRows, int numberOfColumns)
        if (numberOfRows <= 0)
          throw new IllegalArgumentException("Cannot construct Matrix with " +
            numberOfRows + " rows.  Number of rows must be positive.");
        if (numberOfColumns <= 0)
          throw new IllegalArgumentException("Cannot construct Matrix with " +
            numberOfColumns + " columns.  Number of columns must be positive.");
        entries = new IntegerNode[numberOfRows][numberOfColumns];
        this.numberOfRows = numberOfRows;
        this.numberOfColumns = numberOfColumns;
      public static void main (String [] args) throws IOException {
           File myFile1 = getFileName();
           Matrix myMatrix1 = Matrix.readMatrixFromFile(myFile1, "Matrix 1");
           File myFile2 = getFileName();
           Matrix myMatrix2 = Matrix.readMatrixFromFile(myFile2, "Matrix 2");
           System.out.println();
           System.out.println("Printing out Matrix 1");
           System.out.println("---------------------");
           myMatrix1.print();
           System.out.println("Printing out Matrix 2");
           System.out.println("---------------------");      
           myMatrix2.print();
           String myOperation = getAction();
           Matrix.performActionOnMatrices(myMatrix1, myMatrix2, myOperation);        
       public static Matrix readMatrixFromFile(File file, String fname)
        throws IOException
        BufferedReader reader =
          new BufferedReader(new FileReader(file));
        // first line should be number of rows followed by number of columns
        String line = reader.readLine();
        if (line == null)
          throw new IOException("File \"" + file + "\" is empty.");
        int[] dimensions = readInts(line, 2);
        System.out.println("The dimensions of " + fname + " are " + dimensions[0] + " by " +
          dimensions[1] + ".");
        Matrix matrix = new Matrix(dimensions[0], dimensions[1]);
           for (int row = 0; row < dimensions[0]; ++row) {           
                line = reader.readLine();
                if (line == null)
                     throw new IOException("Matrix in file should have " + dimensions[0] + " rows.");
                int[] rowValues = readInts(line, dimensions[1]);
                for (int column = 0; column < dimensions[1]; ++column)
                     matrix.setEntry(row, column, rowValues[column]);
        return matrix;
      public static String getAction() throws IOException {
           System.out.println("What operation would you like to perform on these matrices? (add, subtract, multiply, or determinant) ... ");
           String actionToTake = stdin.readLine();
           return actionToTake;
      public static File getFileName() throws IOException {
           System.out.println( "Please enter the full path and name of a file that contains a valid matrix ... " );
           String fname = stdin.readLine();
           File someFile = new File(fname);
           return someFile;      
      public static void performActionOnMatrices(Matrix matrix1, Matrix matrix2, String action) {
           if ((!action.equals("add")) && (!action.equals("subtract")) && (!action.equals("multiply")) && (!action.equals("determinant"))) {
               throw new IllegalArgumentException("The only valid actions are add, subtract, multiply or determinant.");           
           if (action.equals("add")) {
                if ((matrix1.numberOfRows != matrix2.numberOfRows) || (matrix1.numberOfColumns != matrix2.numberOfColumns)) {
                    throw new IllegalArgumentException("The matrices must contain the same number of rows and columns in order to perform addition on them.");           
                System.out.println("Performing addition on the two matrices...");
                Matrix addMatrix = Matrix.add(matrix1, matrix2);
                System.out.println("Here is the sum of the two matrices:");
                System.out.println("------------------------------------------");
                addMatrix.print();
           } else if (action.equals("subtract")) {
                if ((matrix1.numberOfRows != matrix2.numberOfRows) || (matrix1.numberOfColumns != matrix2.numberOfColumns)) {
                    throw new IllegalArgumentException("The matrices must contain the same number of rows and columns in order to perform subtraction on them.");           
                System.out.println("Performing subtraction on the two matrices...");
                Matrix subtractMatrix = Matrix.subtract(matrix1, matrix2);
                System.out.println("Here is the result of the subtraction:");
                System.out.println("---------------------------------------------");
                subtractMatrix.print();           
           } else if (action.equals("multiply")) {
                if ((matrix1.numberOfRows != matrix2.numberOfRows) || (matrix1.numberOfColumns != matrix2.numberOfColumns)) {
                    throw new IllegalArgumentException("The matrices must contain the same number of rows and columns in order to perform multiplication on them.");           
                if (matrix1.numberOfRows != matrix2.numberOfColumns) {
                    throw new IllegalArgumentException("The number of rows in the first Matrix must equal the number of columns in the second for multiplying.");                       
                System.out.println("Performing multiplication on the two matrices...");
                Matrix multMatrix = Matrix.multiply(matrix1, matrix2);
                System.out.println("Here is the product of the two matrices:");
                System.out.println("------------------------------------------");
                multMatrix.print();
           }     else if (action.equals("determinant")) {
                int det1 = matrix1.determinant();
                System.out.println("Determinant of Matrix 1");
                System.out.println("-----------------------");     
                System.out.println(det1);
                System.out.println();
                int det2 = matrix2.determinant();
                System.out.println("Determinant of Matrix 2");
                System.out.println("-----------------------");     
                System.out.println(det2);
                System.out.println();           
      //  Sets the entry in the matrix at the given row & column to
      //    the given value.
      public void setEntry(int row, int column, int value)
        if ((row < 0) || (row >= numberOfRows))
          throw new IllegalArgumentException("Illegal row index " + row +
            ".  Index should be between 0 and " + (numberOfRows-1));
        if ((column < 0) || (column >= numberOfColumns))
          throw new IllegalArgumentException("Illegal column index " + column +
            ".  Index should be between 0 and " + (numberOfColumns-1));
        //if (value != 0) {
             IntegerNode newNode = new IntegerNode();
             newNode.setItem(value);
             entries[row][column] = newNode;
      //  Returns the matrix entry at the given row & column
      public IntegerNode getEntry(int row, int column)
        if ((row < 0) || (row >= numberOfRows))
          throw new IllegalArgumentException("Illegal row index " + row +
            ".  Index should be between 0 and " + (numberOfRows-1));
        if ((column < 0) || (column >= numberOfColumns))
          throw new IllegalArgumentException("Illegal column index " + column +
            ".  Index should be between 0 and " + (numberOfColumns-1));
        return entries[row][column];
      //  A primitive routine to print the matrix.  It doesn't do
      //    anything smart or nice about spacing.
      public void print()
        for (int row = 0; row < numberOfRows; ++row)
          for (int column = 0; column < numberOfColumns; ++column)
               if (getEntry(row,column) != null) {
                    System.out.print(getEntry(row, column).getItem() + " ");
          System.out.println();
        System.out.println();
      public void linkNodesInEachRow()
           int counter;
           for (int row = 0; row < numberOfRows; ++row)
             counter = 0;
             for (int column = 0; column < numberOfColumns; ++column)
                  if (getEntry(row,column) != null) {
                       counter++;
                       if (counter == 1) {
                            head = new IntegerNode();
                            head.setItem(getEntry(row, column).getItem());
                       } else {
                       //System.out.print("ITEM NUMBER " + counter + " = ");
                       //System.out.println(getEntry(row, column).getItem() + " ");
             System.out.println();
        System.out.println();
           /*for (IntegerNode curr = head; curr != null; curr = curr.getNext()) {
                System.out.println(curr.getItem());
      //  Returns the determinant of the matrix.
      //  This method checks that the matrix is square and throws
      //    an exception if not.
      public int determinant()
         int determinantValue = 0;
         int counter;
         int plusminus = 1; // start with positive value
         // Make sure the matrix is square before proceeding with
        //   determinant calculation
        if (numberOfRows != numberOfColumns)
          // should really create a MatrixException type
          throw new IllegalArgumentException(
            "Cannot compute determinant of non-square (" + numberOfRows +
            " by " + numberOfColumns + ") matrix.");
        } else {
             // the matrix has the same number of rows and columns 
             if (numberOfColumns == 1)
                  // the matrix is 1x1 - the determinant is just it's value
                  return entries[0][0].getItem();
             else if (numberOfColumns == 2)
                  // the matrix is 2x2 - return ad - bc
                  return entries[0][0].getItem() * entries[1][1].getItem() - entries[0][1].getItem() * entries[1][0].getItem();
             else
                  // the matrix is larger than 2x2
                  // loop through the columns in the matrix
                  for (counter = 0; counter < numberOfColumns; counter++)
                       determinantValue += plusminus * entries[0][counter].getItem() * minor(0, counter).determinant(); // The determinant is the sum of all the n possible signed products formed from the matrix using each row and each column only once for each product.  Notice the recursive call using the submatrix.
                       plusminus *= -1;  // switch the plus/minus sign of the multiplier on each iteration through the loop
             return determinantValue;
    // returns a matrix representing the minor of the matrix
    // for the specified row and column
    public Matrix minor(int row, int column)
        int rowsA;
        int rowsB;
        int colsA;
        int colsB;
        // decrease the size of the resultant matrix by 1 row and 1 column
        Matrix smallerMatrix = new Matrix (numberOfRows - 1, numberOfColumns - 1);
        // scroll through the rows and columns in the original Matrix
        // copy all of the values from the original Matrix except the one row and column that were passed in
        for (rowsA=0, rowsB=0; rowsA < numberOfRows; rowsA++)
           if (rowsA != row)
              for (colsA=0, colsB=0; colsA < numberOfColumns; colsA++)
                 if (colsA != column)
                     // the current row and column do not match the row and column we wish to remove
                     // set the values in the appropriate positions of the sub matrix
                    smallerMatrix.setEntry(rowsB, colsB, entries[rowsA][colsA].getItem());
                    colsB++;
              rowsB++;
        return smallerMatrix;     
      //  Used to parse the row of ints provided in the file input to
      //    this program.  Given a string containing at least numberToRead
      //    ints, it creates and returns an int array contaning those
      //    ints.
      private static int[] readInts(String someInts, int numberToRead)
        StringTokenizer tokenizer = new StringTokenizer(someInts);
        if (numberToRead < 0)
          throw new IllegalArgumentException("Cannot read " + numberToRead
            + " ints.  numberToRead must be nonnegative.");
        int[] toReturn = new int[numberToRead];
        for (int i = 0; i < numberToRead; ++i)
          if (!tokenizer.hasMoreTokens())
            throw new IllegalArgumentException("Cannot read " + numberToRead +
              " ints from string \"" + someInts + "\".");
          String token = tokenizer.nextToken();
          toReturn[i] = Integer.parseInt(token);
        return toReturn;
      public static Matrix add (Matrix a, Matrix b)
           Matrix result = new Matrix(a.numberOfRows, a.numberOfColumns);
          for(int i = 0; i < a.numberOfRows; i++)
             for(int j = 0; j < a.numberOfColumns; j++)
                 int value = a.getEntry(i, j).getItem() + b.getEntry(i, j).getItem();
                 result.setEntry(i, j, value);
          System.out.println("Addition complete.");
          return result;
      public static Matrix subtract (Matrix a, Matrix b)
           Matrix result = new Matrix(a.numberOfRows, a.numberOfColumns);
           for(int i = 0; i < a.numberOfRows; i++)
             for(int j = 0; j < a.numberOfColumns; j++)
                 int value = a.getEntry(i, j).getItem() - b.getEntry(i, j).getItem();
                 result.setEntry(i, j, value);
          System.out.println("Subtraction complete.");
          return result;
      public static Matrix multiply (Matrix a, Matrix b)
          Matrix result = new Matrix(a.numberOfRows, b.numberOfColumns);
          int colSum = 0;
          for(int i = 0; i < a.numberOfRows; i++)
              for(int j = 0; j < b.numberOfColumns; j++)
                  colSum = 0;
                  for(int k = 0; k < a.numberOfColumns; k++)
                     colSum += a.getEntry(i,k).getItem() * b.getEntry(k,j).getItem();
                  result.setEntry(i, j, colSum);
          System.out.println("Multiplication complete.");
          return result;
      public class IntegerNode {
              private int item;
              private IntegerNode next;
              public void setItem(int newItem) {
                   item = newItem;
              public int getItem() {
                   return item;
              public void setNext(IntegerNode nextNode) {
                   next = nextNode;
              public IntegerNode getNext() {
                   return next;
    }

    Please help. The code runs just fine. The only thing is I need to link the nodes together (for each row) into a linked list and then put each linked list into an array. I need help with setEntry. The details of creating a node, attaching it to the list representing a row, etc. need to be in setEntry. Please help.
    For the following matrix:
    1 4 5
    4 2 5
    2 1 2
    There is an array of three linked lists.
    LinkedListsArray[0] = Entry(value=1, column=0)->Entry(value=4, column=1)->Entry(value=5, column=2)
    LinkedListsArray[1] = Entry(value=4, column=0)->Entry(value=2, column=1)->Entry(value=5, column=2)
    LinkedListsArray[2] = .....
    Each entry is a node in the linked list.
    The last twist is that if any values are zero, they shouldn't have nodes associated with them. Don't allocate nodes for zero valued entries.

  • I need help with event structure. I am trying to feed the index of the array, the index can vary from 0 to 7. Based on the logic ouput of a comparison, the index buffer should increment ?

    I need help with event structure.
    I am trying to feed the index of the array, the index number can vary from 0 to 7.
    Based on the logic ouput of a comparison, the index buffer should increment
    or decrement every time the output of comparsion changes(event change). I guess I need to use event structure?
    (My event code doesn't execute when there is an  event at its input /comparator changes its boolean state.
    Anyone coded on similar lines? Any ideas appreciated.
    Thanks in advance!

    You don't need an Event Structure, a simple State Machine would be more appropriate.
    There are many examples of State Machines within this forum.
    RayR

  • Help with High School Football Recruiting DVD

    Hello,
    I need help with making a DVD highlighting my son's High School Football plays.
    I have 10 different DVD's (with 10 different High School Football games that he played in) and I would like to cut various snippets (segments) from each DVD that illustrate his great plays . . . and then put them together onto ONE DVD + add music and I want to add writing too.
    I don't know where to begin.
    Can anyone help guide me please ?

    You will find best advice over on the video forum. Most of us here are photographers.
    Click on the link below and copy and paste your question again. Good luck.
    Video questions: Click here for Premiere Elements Forum

  • Need help with connecting file inputs to arrays

    In this assignment I have a program that will do the following: display a list of names inputed by the user in reverse order, display any names that begin with M or m, and display any names with 5 or more letters. This is all done with arrays.
    That was the fun part. The next part requires me to take the names from a Notepad file, them through the arrays and then output them to a second Notepad file.
    Here is the original program: (view in full screen so that the code doesn't get jumbled)
    import java.io.*;       //Imports the Java library
    class progB                    //Defines class
        public static void main (String[] arguments) throws IOException
            BufferedReader keyboard;                                  //<-
            InputStreamReader reader;                                 //  Allows the program to
            reader = new InputStreamReader (System.in);               //  read the the keyboard
            keyboard = new BufferedReader (reader);                  //<-
            String name;                 //Assigns the name variable which will be parsed into...
            int newnames;               //...the integer variable for the amount of names.
            int order = 0;              //The integer variable that will be used to set the array size
            String[] array;             //Dynamic array (empty)
            System.out.println (" How many names do you want to input?");   //This will get the number that will later define the array
            name = keyboard.readLine ();
            newnames = Integer.parseInt (name);                                         // Converts the String into the Integer variable
            array = new String [newnames];                                               //This defines the size of the array
            DataInput Imp = new DataInputStream (System.in);       //Allows data to be input into the array
            String temp;                                       
            int length;                                                                  //Defines the length of the array for a loop later on
                for (order = 0 ; order < newnames ; order++)                                //<-
                {                                                                           //  Takes the inputed names and
                    System.out.println (" Please input name ");                            //  gives them a number according to
                    temp = keyboard.readLine ();                                           //  the order they were inputed in
                    array [order] = temp;                                                  //<-
                for (order = newnames - 1 ; order >= 0 ; order--)                                //<-
                {                                                                                //  Outputs the names in the reverse 
                    System.out.print (" \n ");                                                   //  order that they were inputed
                    System.out.println (" Name " + order + " is " + array [order]);             //<-
                for (order = 0 ; order < newnames ; order++)                                  //<-
                    if (array [order].startsWith ("M") || array [order].startsWith ("m"))     //  Finds and outputs any and all
                    {                                                                         //  names that begin with M or m
                        System.out.print (" \n ");                                            //
                        System.out.println (array [order] + (" starts with M or m"));         //
                    }                                                                         //<-
                for (order = 0 ; order < newnames ; order++)                                            //<-
                    length = array [order].length ();                                                   //
                    if (length >= 5)                                                                    //  Finds and outputs names
                    {                                                                                  //  with 5 or more letters
                        System.out.print (" \n ");                                                      //
                        System.out.println ("Name " + array [order] + " have 5 or more letters ");      //<-
    }The notepad file contains the following names:
    jim
    laruie
    tim
    timothy
    manny
    joseph
    matty
    amanda
    I have tried various methods but the one thing that really gets me is the fact that i can't find a way to connect the names to the arrays. Opening the file with FileInputStream is easy enough but using the names and then outputing them is quite hard. (unless i'm thinking too hard and there really is a simple method)

    By "connect", do you just mean you want to put the names into an array?
    array[0] = "jim"
    array[1] = "laruie"
    and so on?
    That shouldn't be difficult at all, provided you know how to open a file for reading, and how to read a line of text from it. You can just read the line of text, put it in the array position you want, until the file is exhausted. Then open a file for writing, loop through the array, and write a line.
    What part of all that do you need help with?

  • I need help with 2 arrays

    I need help with this portion of my program, it's supposed to loop through the array and pull out the highest inputted score, currently it's only outputting what is in studentScoreTF[0].      
    private class HighScoreButtonHandler implements ActionListener
               public void actionPerformed(ActionEvent e)
              double highScore = 0;
              int endScore = 0;
              double finalScore = 0;
              String tempHigh;
              String tempScore;
              for(int score = 0; score < studentScoreTF.length; score++)
              tempHigh = studentScoreTF[score].getText();
                    tempScore = studentScoreTF[endScore].getText();
              if(tempHigh.length() <  tempScore.length())
                   highScore++;
                   finalScore = Double.parseDouble(tempScore);
             JOptionPane.showMessageDialog(null, "Highest Class Score is: " + finalScore);This is another part of the program, it's supposed to loop through the student names array and pull out the the names of the students with the highest score, again it's only outputting what's in studentName[0].
         private class StudentsButtonHandler implements ActionListener
               public void actionPerformed(ActionEvent e)
              int a = 0;
              int b = 0;
              int c = 0;
              double fini = 0;
              String name;
              String score;
              String finale;
              String finalName = new String();
              name = studentNameTF[a].getText();
              score = studentScoreTF.getText();
              finale = studentScoreTF[c].getText();
              if(score.length() < finale.length())
                   fini++;     
                   name = finalName + finale;
         JOptionPane.showMessageDialog(null, "Student(s) with the highest score: " + name);
                   } Any help would be appreciated, this is getting frustrating and I'm starting to get a headache from it, lol.
    Edited by: SammyP on Oct 29, 2009 4:18 PM
    Edited by: SammyP on Oct 29, 2009 4:19 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Heres a working example:
    class Compare {
        public int getHighest(int[] set) {
            int high = set[0];
            for(int i = 0; i < set.length; i++) {
                if(set[i] > high) {
                    high = set;
    return high;

  • Help with arrays...Please Help

    Hello,
    Iam trying to make a library system. I have three classes, one for the GUI, User class, and Users class. User class instantiates an object with all the relevant data like, Name, Age, Address, etc. The Users class contains a array of User Objects.
    With this program I have to be able to create users, display users and delete users. The problem Iam having is displaying them. (I think I correctly store the User Objectsin the array, and Iam having problems retreiving them). The thing is when I run the program I don't get any exception errors, just nothing gets displayed!
    Here is part of my code:
    public class Users {
    //declaring variables
    public Users (){
    initialiseArray();
    public void initialiseArray(){
    userArray = new User [50];
    // This method first checks to see if there is enough room for a new
    // user object. If there is the object is added to the array, if there is'nt
    // Then method expandUserArray is called to make room for the user
    public void addUser( User user)
    if (userArraySize == userArray.length) {
    expandUserArray();
    userArray[userArraySize] = user;
    userArraySize++;
    // In this method first the user is searched for in the array, if found
    // Then method decreaseUserArray is called to delete the user
    public void deleteUser ( User user )
    location = 0;
    while (location < userArraySize && userArray[location] != user) {
    location++;
    if (userArray[location] == user) {
    decreaseUserArray(location);
    public void displayUsers( ){
    for (int i = 0; i < userArraySize; i++) {
    usersInformation += "\n" + (userArray.getUserName());
    usersInformation += "\t" + (userArray[i].getUserID());
    usersInformation += "\t" + (userArray[i].getUserAddress());
    public String getUserInformation(){
    //usersInformation = userInformation.toString();
    return usersInformation;
    // The User is deleted by shifting all the above users one place down
    private void decreaseUserArray(int loc)
    userArray[loc] = userArray[userArraySize - 1];
    userArray[userArraySize - 1] = null;
    userArraySize--;
    // This method increase the size of the array by 50%
    private void expandUserArray( )
    int newSize = (int) (userArray.length * increasePercentage);
    User newUserArray[] = new User[newSize];
    for (int i = 0; i < userArray.length; i++) {
    newUserArray[i] = userArray[i];
    userArray = newUserArray;
    Is there anything wrong with my arrays??? Here is part of my code for action performed:
    void addUserButton_actionPerformed(ActionEvent e) {
    newUserName = userNameTextField.getText();
    newUserAddress = userAdressTextField.getText();
    newUserID = Integer.parseInt ( userIDTextField.getText());
    User newUser = new User (newUserName, newUserAddress, newUserID);
    Users users = new Users();
    users.addUser(newUser);
    clearButton();
    void displayUsersButton_actionPerformed(ActionEvent e) {
    Users users = new Users();
    users.displayUsers();
    displayUsersTextArea.append (users.getUserInformation());
    void deleteUserButton_actionPerformed(ActionEvent e) {
    //Still incomplete
    Thanks for your help!

    First, PLEASE USE THE SPECIAL TOKENS FOUND AT
    http://forum.java.sun.com/faq.jsp#messageformat WHEN
    POSTING CODE!!!! Sorry about that, Iam new and I did'nt know about Special Tokens.
    As far as the problem, let me start out by asking if
    you've considered using a class that implements the
    List interface. Perhaps Vector or ArrayList would
    make a better choice since they already handle
    "growing" and "shrinking" for you.I tried using vector arrays but it got too complicated. It was very easy to add and remove objects from the vector but I never figured out how to display all the objects with all the data.
    public void displayUsers( ){
    for (int i = 0; i < userArraySize; i++) {
    usersInformation += "\n" +
    " + (userArray.getUserName());   //what is
    usersInformation?  Also, how does getUserName(),
    getUserID(), getUserAddress() know which user object
    to operate on if these are methods of userArray?
    usersInformation += "\t" +
    " + (userArray.getUserID());     //I'm guess you've
    only posted "some" of your code. 
    usersInformation += "\t" +
    " + (userArray.getUserAddress());//Try posting all
    that you have so far, and please use the special
    tokens to format your code.
    }I made a mistake while I was cutting & pasting my code. It should be for example:
    usersInformation += "\n" (userArray.getUserName());
    The comment about instanciating a new Users for each
    actionPerformed is on point. You are replacing your
    Usres with a new object each time.Yep this was the problem. I just changed the constructor, declared and
    created object of Users elsewhere.
    Thanks for your help!

  • Help with Array of Arrays

    import java.util.Arrays;
    import java.util.Date;
    import java.util.List;
    public class StockDay
        private String[] stockDayData;
        List stockDays = new ArrayList();
        public StockDay(String stockData)
            stockDayData = new String[6];
            String[] stockDayData= stockData.split(",");
            stockDays.add(stockDayData[]);
    }I have an outside class calling this class with a string of data separated by commas. I am trying to separate the data so that each time the method is called, each piece of the data (6 total) is put into an array list. Then that array list is put into an array list of arrays. I am sorry if I have not made this clear, I will try again. I want an array of arrays, and the interior arrays will contain 6 pieces of information each from the string that is given to the method, and each separated by commas.
    Any help is much appreciated. I am also curious how I can accesses one piece of the data at a time, this is what I am thinking for this:
    data = arraylist1[#].arraylist2[#]this would set data equal to whatever is in arraylist2[#]
    Thank you very much.

    ActingRude wrote:
    I meant just a simple Array I guess.Note the difference between Array and array. Class names start with uppercase in java. There is a class called Array, but it's just a utility class, and isn't part of arrays.
    .. like I am using above? I was under the impression that the biggest syntax difference between an array(fixed number of items) and an ArrayList(unfixed number of items) was the use of the [] and () That's one of many syntactical differences, yes, but the main difference is not in the syntax. arrays are part of the Java language, have special handling because of that, and are faster and smaller than ArrayLists. ArrayList is part of the API, and didn't exist until Java 1.2 (about 5-6 years into Java's life, I think), and is built on top of an array.
    UnsupportedOperationException:
    null (in java.util.AbstractList)I have no idea what is causing this, I can only assume that I am doing something wrong...It looks like you're tyring to add null to an ArrayList and it doesn't like it. I thought ArrayList accepted null elements, but I could be wrong. Paste in the exact line that's causing it, and any declarations necessary to clarify any variables used on that line.

  • Help with array question

    hi,
    i need some help with this piece of code. wat would it output to the screen?
    int [] theArray = { 1,2,3,4,5};
    for (int i = 1; i < 5; i++)
    System.out.print(theArray * i + "; ");
    would it output 1 * 1;
    2 * 2;...
    thanx
    devin

    Ok...
    1] Your index into the array is off by 1 - remember that array indexing starts from 0.
    2] You cannot multiply an array object. The contents? fine , go ahead but NOT the array
    so your output should be something like:
    operator * cannot be applied to int[] :d
    try
    int[] theArray = {0,1,2,3,4,5};
    for(int i = 1;i<6;i++)
         System.out.print(theArray*i+";");
    giving you an output of 1;4;9;16;n...
    if you were looking for the output stated change
    System.out.print(theArray*i+";");
    to
    System.out.print(theArray[i]+"*"+i+";");done...

  • HELP WITH CHAR ARRAY

    Here is the go folks this is a pice of code which I was helped with by a member of this forum, THANX HEAPS DUDE. What has happened now is the criteria is changed, previously it would search for a string in the vector. But now I have to have searches with wildcards, so it needs to utilize a char array methinks. So it will go through change the parameter to a char array, then go through the getDirector() method to return a director string, then it needs to loop through the char array and check if the letters are the same. then exit on the wild card. Now all this needs to be happening while this contruct down the bottom is looping through all the different elements in the moviesVector :s if anyone could give me a hand it is verry welcome. I must say also that this forum is very well run. 5 stars
    public void searchMovies(java.lang.String searchTerm) {
    Iterator i = moviesVector.iterator();
    while (i.hasNext()) {
    Movie thisMovie = (Movie)i.next();
    //Now do what you want with thisMovie. for instanse:
    if (thisMovie.getDirector().equals(searchTerm))
    foundMovies.add(thisMovie);
    //assumes foundMovies is some collection that we will
    //return later... or if you just want one movie, you can:
    //return thisMovie; right here.
    }

    Sorry, I clicked submit, but i didnt enable to wtch it, so i stoped it before it had sent fully. Evidently that didnt work.

  • Help with DIgital Output Array with 6062E DAQ CARD...

    Good morning, folks... I need some help with digital output of the 6062E PCMCIA card... I can output 1 line without problems... I need to control a 4066 with my digital outputs... I am doing this without greater problems... but there's something... I need that when one of my outputs is high, the others become low, unchangeably... so I tried to use an array to control my output and I couldn't do that... some errors showed up... can you help me please? Maybe there's any errors at my software, then I thank you if you help me... the vi is anexed...
    Best Regards...
    Attachments:
    Untitled 3.vi ‏20 KB

    See below for one of many methods. Change the "lines" string for your setup.
    Also, please explore the Examples that ship with LabVIEW, and read your card's manual.
    Richard

  • Hello guys need help with reverse array

    Need help reversing an array, i think my code is correct but it still does not work, so im thinking it might be something else i do not see.
    so far the input for the array is
    6, 25 , 10 , 5
    and output is still the same
    6 , 25 , 10 , 5
    not sure what is going on.
    public class Purse
        // max possible # of coins in a purse
        private static final int MAX = 10;
        private int contents[];
        private int count;      // count # of coins stored in contents[]
         * Constructor for objects of class Purse
        public Purse()
           contents = new int[MAX];
           count = 0;
         * Adds a coin to the end of a purse
         * @param  coinType     type of coin to add
        public void addCoin(int coinType)
            contents[count] = coinType;
            count = count + 1;
         * Generates a String that holds the contents of a purse
         * @return     the contents of the purse, nicely formatted
        public String toString()
            if (count == 0)
                return "()";
            StringBuffer s = new StringBuffer("(");
            int i = 0;
            for (i = 0; i < count - 1; ++i)
                s.append(contents[i] + ", "); // values neatly separated by commas
            s.append(contents[i] + ")");
            return s.toString();
         * Calculates the value of a purse
         * @return     value of the purse in cents
        public int value()
            int sum = 0; // starts sum at zero
            for( int e : contents) // sets all to e
                sum = sum + e; //finds sum of array
            return sum; //retur
         * Reverses the order of coins in a purse and returns it
        public void reverse()
           int countA = 0;
           int x = 0;
           int y = countA - 1;                                          // 5 - 1 = 4
           for (int i = contents.length - 1; i >=0 ; i--)                        // 4, 3 , 2, 1, 0
                countA++;                                             // count = 5
            while ( x < y)
                int temp = contents[x];
                contents[x] = contents [y];
                contents [y] = temp;
                y = y- 1;                                         // 4 , 3 , 2, 1 , 0
                x = x + 1 ;                                             // 0 , 1,  2  , 3 , 4
    }

    ok so i went ahead and followed what you said
    public void reverse()
          int a = 0;
          int b = contents.length - 1;
          while (b > a)
              int temp = contents[a];
              contents[a] = contents;
    contents [b] = temp;
    a++;
    b--;
    }and its outputting { 0, 0, 0, 0}
    im thinking this is because the main array is has 10 elements with only 4 in use so this is a partial array.
    Example
    the array is { 6, 25, 10, 5, 0, 0, 0, 0, 0, 0,}
    after the swap
    {0, 0 , 0 , 0, 0 , 0 , 5 , 10 , 25, 6}
    i need it to be just
    { 5, 10, 25, 6}
    so it is swapping the begining and end but only with zeroes the thing is i need to reverse the array without the zeroes                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Please Help With Arrays

    I really need some help with the following two methods:
    - A method fillArray() that accepts an integer array as a parameter and fills the array with random integers. I am encouraged to use Math.random()
    - A method printArray() that accepts an integer array as a parameter and outputs every element of the array to the standard output device. I am encouraged to use print instead of println in order to save paper.
    Thanks so much for your help.

    public class Test {
       public static void main (String[] args){
           int[] intArray = new int[20];
           fillArray(intArray);
           printArray(intArray);
       public static void fillArray (int[] intArray){
           for (int i = 0; i < intArray.length; i++) {
               intArray[i] = (int) (Math.random()*1000);
       public static void printArray (int[] intArray){
           for (int i = 0; i < intArray.length; i++) {
               int i1 = intArray;
    System.out.print(i1+",");
    System.out.println("");

Maybe you are looking for

  • Jampack and keyboard connection questions

    2 questions: 1. I have just bought GB Jampack (the one with lots of extra loops), but can't seem to notice any difference. How do I know that the disc has downloaded OK? Can't remember how many loops were there in the first place! 2. I'm trying to co

  • How do you get Firebox to save a bookmark to the last bookmark folder you used?

    In previous versions of Firefox, when I went to save a bookmark, it use to pull up the previous bookmark file that I used. This is very handy if you're bookmarking several websites into the same category instead of having to search for the same file

  • Problems about Hold Data

    Hi All, I'm confused by the usage of "Hold Data" menu. I ran the t-code SE16 to check the table T002. In the selection screen I input "DE" in the SPRS field and then click on the menu System -> User Profile -> Hold Data. System indicates that "Data w

  • CP1215 Photo Problem Ignored

    I have seen a couple of questions regarding the CP1215 Photo Printing problem, with no valid answer.  Pictures print dark no matter what software, OS  or computer you are printing from. Is there any way that we can change that , changing the contrast

  • Using older OS with iPad

    I am thinking of buying an iPad. I see that the specs require OS 10.5 or above. I have OS 10.4.11. What problems will I encounter using an iPad with my computer?