User Profile

Collapse

Profile Sidebar

Collapse
vitaminz
vitaminz
Last Activity: Aug 13 '08, 10:38 AM
Joined: Aug 6 '08
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • vitaminz
    replied to Setting an object to blank?
    in Java
    Ahhh, thanks, that seems to work great :) I've made it set the sold cars fields to 0, then had my save car method skip over any lines with just 0.

    Thanks again!
    See more | Go to post

    Leave a comment:


  • vitaminz
    replied to Setting an object to blank?
    in Java
    Thanks for the reply :)

    Maybe I should explain about my program first, sorry last night I didn't really explain much.

    The first thing that happens when the program is run, is the car details text file is loaded and convert into an object array. The coding used to do this is (the text file is opened with a BufferedReader previously, but I thought copying that code would be a bit pointless)

    Code:
    
    
    ...
    See more | Go to post

    Leave a comment:


  • vitaminz
    started a topic Setting an object to blank?
    in Java

    Setting an object to blank?

    Hi it's me again, I've pretty much finished a program I'm making, which does the following:

    The program is for a garage, and it does the following functions:

    Adds a new car
    Display cars
    Amend price of a car
    Delete car ('sell' car)
    Find a certain car

    When the program is loaded, it attempts to read existing car data from a text file, which is then converted into an object array....
    See more | Go to post

  • vitaminz
    replied to Deleting from a text file
    in Java
    Just saying I'm pretty sure that the problem is this line:
    Code:
    carDetails[search] = null;
    Is that the right method to delete an object?
    See more | Go to post

    Leave a comment:


  • vitaminz
    replied to Deleting from a text file
    in Java
    Thanks for the replies :)

    The line is actually in a different method, sorry I seem to have got confused! It's in the saveCarDetails method, but other methods also use this to save details, and they have no trouble. The saveCarDetails method is the following:

    Code:
       public void saveCarDetails() throws IOException
       {
           {
             PrintWriter outputFile;
             
             outputFile
    ...
    See more | Go to post

    Leave a comment:


  • vitaminz
    started a topic Deleting from a text file
    in Java

    Deleting from a text file

    Hi it's me again, I've pretty much finished a program I'm making, which does the following:

    The program is for a garage, and it does the following functions:

    Adds a new car
    Display cars
    Amend price of a car
    Delete car ('sell' car)
    Find a certain car

    Almost everything is working perfect, except that I can't get the 'delete'f unction working correctly.

    All the cars...
    See more | Go to post

  • vitaminz
    replied to Inserting into an object
    in Java
    The NullPointer references two methods: this line from the code I posted:
    Code:
    carDetails[activeCars].setRegNo(tempRegNo);
    And the reference in the main method which starts the opens that method.

    If it's any help, this is the method for loading the car details, maybe I've messed up this.

    Code:
          inputCarFile = Text.open ( textFilesPath + "car details.txt" );
    ...
    See more | Go to post

    Leave a comment:


  • vitaminz
    replied to Inserting into an object
    in Java
    Thanks for the reply :)

    Yeah, I have this in the public class:

    private static final int MAX_CARS = 10;
    private Car [] carDetails = new Car[MAX_CARS];

    and in the database currently is only 4 cars, so it hasn't reached the max :-?
    See more | Go to post

    Leave a comment:


  • vitaminz
    started a topic Inserting into an object
    in Java

    Inserting into an object

    Hi, I am currently designing a program and I've run into a problem - It's probably really easy to solve, but heck it's late and I can't think lol.

    I'm designing a program to store details of cars (i.e. a garage), and the car details are all stored in a text file, and the text file is terminated with ****. The program first loads the existing car details using a BufferedReader, then each cars details is converted into a position in...
    See more | Go to post

  • vitaminz
    replied to Testing if a string is NOT equal to...
    in Java
    Wow, thanks for the speedy reply,t hat works perfect :) Thanks again
    See more | Go to post

    Leave a comment:


  • vitaminz
    started a topic Testing if a string is NOT equal to...
    in Java

    Testing if a string is NOT equal to...

    Hi, I'm currently coding a Java program for a University coursework, and I'm a little bit stuck.

    How do I find out if a string is NOT equal to a certain value? I know to test if it is equal, you use .equals, but I have no idea how to test if it's not equal to.

    Thanks
    See more | Go to post
No activity results to display
Show More
Working...