Rhenz List
Rhenz List
package Package1; }
}
import java.io.*; public void display() throws IOException{
import java.util.*; System.out.println(ar);
}
public class SanPedro_List { public void exit() throws IOException{
BufferedReader inp= new System.out.println("GOODBYE");
BufferedReader(new System.exit(0);
InputStreamReader(System.in)); }
int index; Object k; public static void main(String[] args) throws
List ar= new ArrayList(index); IOException {
int i, o=0;
public void index() throws IOException{ SanPedro_List ok=new SanPedro_List();
System.out.print("How many index do you do{
want? "); System.out.println("1. Add");
index = Integer.parseInt(inp.readLine()); System.out.println("2. Edit");
} System.out.println("3. Delete");
public void add() throws IOException{ System.out.println("4. Search");
System.out.println("Enter you want to add: System.out.println("5. Display");
"); System.out.println("6. Exit");
for(int i=0;i<index;i++) System.out.print("Enter your choice: ");
k=inp.readLine(); i=Integer.parseInt(ok.inp.readLine());
ar.add(k);
} switch(i){
public void edit() throws IOException{ case 1:{
int newInd=0; Object in1,in2; ok.index();
System.out.print("Enter you want to edit: ok.add();
"); break;
in1=inp.readLine(); }
System.out.print("enter new item: "); case 2:{
in2 = inp.readLine(); ok.edit();
for (int j = 0; j < ar.size(); j++) { break;
ar.get(j).equals(in1); }
case 3:{
ar.set(newInd, in1); ok.delete();
} break;
} }
case 4:{
public void delete() throws IOException{ ok.search();
System.out.println("Enter item"); break;
Object some = inp.readLine(); }
for (int ctr = 0; ctr < ar.size(); ctr++) { case 5:{
if (ar.get(ctr).equals(some)) { ok.display();
ar.remove(ctr); break;
} }
} case 6:{
} ok.exit();
public void search() throws IOException{ break;
System.out.println("Enter item"); }
Object s = inp.readLine(); }
if (ar.contains(s)) { }while(o==0);
for (int ctr = 0; ctr < ar.size(); ctr++) { }
if (ar.get(ctr).equals(s)) {
System.out.println(s + " is at index " + ctr); }