I have a Vehicle class which contains all information about Vehicle objects including get and set methods. There is also a Showroom class which maintains a list of all of the Vehicle objects, with methods to add/delete and scroll through the list.

In my main (a seperate class called VehicleDriverClass) I am trying to use I/O to write Vehicle data to a file and read in Vehicle data from a file. I can write to a file fine. I am using notepad and so a .txt file to read from. The problem I am having is with how to terminate the end of a line when reading from the file. Here is the constructor for the Vehicle class, so you know the paramaters. 

```
public Vehicle(String man, String mod, String VIN, String dateOfMan, char taxBand, int     costOfVehicle)
{
    this.manufacturer = man;
    this.model = mod;
    this.VIN = VIN;
    this.dateOfManufacture = dateOfMan;
    this.taxBand = taxBand;
    this.costOfVehicle = costOfVehicle;
}

```

This is what I have for the Input method at the moment (without trying to create the oject, just reading from file). The Showroom s being passed to it is for use later, when I create the vehicle object and add it to the showroom.

// code replaced below.

With this implementation when the dataFromFile is outputted to the console it is all on one line, rather than on new lines. Does readline() not terminate the line when '\n' is read in?

Here is how my data is stored in the input file. 

```
Fordtest\n Focus\n frank\n ioCheck\n 09/01/1989\n 23/11/2013\n true\n d\n 1995\n

```

So for now, how do I get the line to terminate? So that I can then implement the creation of an object from this.

EDIT: I/O is working now. I am now having trouble with the constructor for my Vehicle object needing a the data types char and int for the last two variables. With the current method they are in a string array.

I have removed the code from above and added the new implementation below.public static void 

addNewVehicleFromFile(Showroom s)
 {
 String dataFromFile;
 String[] tokens = null;

```
    try
    {
        File fileReader = new File("AddNewVehicleFromFile.txt");
        FileReader fr = new FileReader(fileReader);
        BufferedReader br = new BufferedReader(fr);

        while ((dataFromFile = br.readLine()) != null)
        {
            tokens = dataFromFile.split("~");
        }

        System.out.println(Arrays.toString(tokens));

        Vehicle inputVehicle = new Vehicle(tokens[0], tokens[1], tokens[2], tokens[3],
                tokens[4], tokens[5]); 
        /*
        Erorr above here with these two. token[4] should be a char and [5] an int
        */

        s.addVehicle(inputVehicle);

        System.out.println("addNewVehicleFromFile Complete");

    }
    catch (FileNotFoundException fnfe)
    {
        System.out.println("File not found exception: " + fnfe.toString());
    }
    catch (IOException ioe)
    {
        System.out.println("I/O exception: " + ioe.toString());
    }

}

```

Should I be writing my own toChar and toInt methods to call for these two variables? Or parsing to int or similar.