/*
8.
Write a Java program to create a vector, add elements at the end, at specified location onto the vector and display the elements.
Write an option driven program using switch...case and also insertion of any type of objects must be possible. Read input as strings and find the type of data and convert them
into appropriate objects of appropriate classes. Handle exception while converting the inputs.*/
import java.io.*;
import java.util.*;
import java.io.BufferedReader;
import java.io.IOException;
class program8 {
public static void main(String[] args)
{
int n = 5,data;
int ch=0;
BufferedReader reader =new BufferedReader(new InputStreamReader(System.in));
Vector v = new Vector(n);
try{
System.out.println("student Succefully Registerd : ");
while(ch!=4){
System.out.println("Enter 1.add 2.remove 3.display 4.exit : ");
ch = Integer.parseInt(reader.readLine());
switch(ch){
case 1:
System.out.println("Enter data to ADD: ");
data = Integer.parseInt(reader.readLine());
v.add(data);
break;
case 2:
System.out.println("REMOVE data at Index 0- n : ");
data = Integer.parseInt(reader.readLine());
v.remove(data);
break;
case 3:
for (int i = 0; i < v.size(); i++)
System.out.println(v.get(i));
break;
case 4:
ch=4;
break;
}
}
}catch(Exception e){
}
}
}