Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: editing array

  1. #1
    Junior Member
    Join Date
    Oct 2009
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default editing array

    Hi new to the forums so Hi to everyone, I hope someone out there can point me in right direction.

    I have a programme creating object orienated items in an array all the questions are asked and then sent to a seperate class but how do i edit it as a whole entry code is below what i want to be able to do for instance is changed all the details but for a user to select the array to change. i have attached part of main program code for normal adding this is when the arrays are empty and also code for the class that bject is sent to,

     if(choice.equals("1"))
           {
           //get book details
           System.out.print("Enter the Taxi Number. ");
           TaxiNo = input.next();
           System.out.print("Enter the Taxi Registration(without spaces) ");
           TaxiReg = input.next();
           System.out.print("Enter the amount of seats available. ");
           TaxiSeats = input.next();
           System.out.print("Is this taxi in service(Y/N) ");
           TaxiServ = input.next();
           System.out.print("Enter the Taxi Location. ");
           TaxiLoco = input.next();
     
           //creat a new object called taxi 1 based on the taxi class
           taxis[taxisInRank] = new Taxi(TaxiNo, TaxiReg, TaxiSeats, TaxiServ, TaxiLoco);
           taxisInRank++;
           System.out.println("Taxi object created");
           System.out.println();
        }

    and the taxi class code

    //Taxi class
     
    class Taxi
    {
    private String No;
    private String Reg;
    private String Seats;
    private String Serv;
    private String Loco;
     
     
    //constructor
    Taxi (String n, String r, String s, String ser, String l)
    {
        No = n;
        Reg = r;
        Seats = s;
        Serv = ser;
        Loco = l;
    }
     
    //method to get title and date
    String getNo()
    {
        return No;
    }
     
    String getReg()
    {
        return Reg;
    }
     
    String getSeats()
    {
        return Seats;
    }
     
    String getServ()
    {
        return Serv;
    }
     
    String getLoco()
    {
        return Loco;
    }
    }

    Many thanks in advance


  2. #2
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,545
    My Mood
    Grumpy
    Thanks
    0
    Thanked 168 Times in 159 Posts

    Default Re: editing array

    Duplicate post

    This thread has been cross posted here:

    http://www.java-forums.org/new-java/42425-editing-array-data.html

    Although cross posting is allowed, for everyone's benefit, please read:

    Java Programming Forums Cross Posting Rules

    The Problems With Cross Posting


Similar Threads

  1. Char array to a String array with hex
    By fortune2k in forum What's Wrong With My Code?
    Replies: 2
    Last Post: February 20th, 2014, 12:01 PM
  2. Editing a date
    By waterjames in forum Java Theory & Questions
    Replies: 0
    Last Post: November 27th, 2010, 01:00 PM
  3. prininting out a 4x4 array according to an order by a 1d array
    By fortune2k in forum Collections and Generics
    Replies: 7
    Last Post: November 25th, 2010, 11:54 AM
  4. 2d (4x4) array insdie a 1d array. (Block cipher)
    By fortune2k in forum Collections and Generics
    Replies: 13
    Last Post: November 23rd, 2010, 04:29 PM
  5. Storing an array into an array
    By vluong in forum Collections and Generics
    Replies: 4
    Last Post: September 22nd, 2009, 02:14 PM