Java Can you take this text file year name month and day it
Java
Can you take this text file
(year) (name) (month and day it started)(month and day it end)(magnitude level of the storm)
2000/Alex/0110/0120/0
2001/Bill/0210/0220/0
2002/Chris/0310/0320/0
2003/Devon/0140/0420/0
2004/Eli/0510/0520/1
2005/Fred/0610/0620/2
2006/Gilbert/0710/0820/3
2007/Herbert/0910/0920/4
2008/Kim/1010/1020/5
and have a java program read it and store it in a LinkedList and let the user delete data and add data
what the user should be able to see right when the program runs
1. Search storm by name
2. Search storm by year
3. Print all storms thats in the text file
4. Close program
Solution
import java.io.*;
import java.util.*;
public class VG {
public static void main(String [] arg) throws IOException {
BufferedReader ReadIn = new BufferedReader
(new FileReader(\"data1.txt\"));
LinkedList<String> Lista = new LinkedList<String> ();
int radNr = 0;
while (true)
{
String Container = ReadIn.readLine(); // Declaring Container as container for the txt
if (Container == null)
break;
radNr++; // adds one for the loop
System.out.println(radNr + \": \" + Container); // Writes out the text
Lista.add(Container);
}
ListIterator it=Lista.listIterator();
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String element;
int position,Choice=0;
while(Choice<4)
{
System.out.println(\"\ LinkedList Operations\");
System.out.println(\"1 add an element\");
System.out.println(\"2 remove an element\");
System.out.println(\"3 change an element\");
System.out.println(\"4 Exit\");
System.out.println(\"your choice:\");
Choice=Integer.parseInt(br.readLine());
switch(Choice)
{
case 1:System.out.println(\"Enter the Element\");
element=br.readLine();
System.out.println(\"At what position?\");
position=Integer.parseInt(br.readLine());
Lista.add(position-1,element);
break;
case 2:System.out.println(\"Enter the position:\");
position=Integer.parseInt(br.readLine());
Lista.remove(position-1);
break;
case 3:System.out.println(\"Enter the position:\");
position=Integer.parseInt(br.readLine());
System.out.print(\"Enter the new element\");
element=br.readLine();
Lista.set(position-1,element);
break;
default:return;
}
}
}
}

