System.out.println ("Enter quantity of cars") // how many cars we will input
(it means we have 1 car, which we will describe bellow, but may be more)
System.out.println("Enter car brand")
Then program will be save data as external XML file (C:\\cars.xml) (<1><brand>Ford</brand><color>Red</color><type>Sedan</type></1>)
In this task i need to use BufferedReader, Exceptions, Array, XML convert..
Post by:Campbell Ritchie
Welcome to thr Ranch
I wouldn't use a buffered reader for keyboard input, since Scanner was introduced 11 years ago. You can print a request and get the data from the keyboard in the appropriate format. Get that working and get the data into a Car class. Then consider writing the XML later.
Post by:Carey Brown
I think your XML would look more like this:
I would have a Car class that has a String toXML() method. And perhaps a Cars class that manages a list of Cars; also with a String toXML() method. Cars.toXML() will be responsible for iterating through the list and calling the Car.toXML() method on each one.
This thread has been viewed 292 times.
All times above are in ranch (not your local) time.
The current ranch time is Dec 15, 2018 05:02:44.