Professional Documents
Culture Documents
Code
Code
//I am importing Java Utility for me to use all of the commands there specially the
Scanner.
package barilproject;
import java.util.*;
}
}
}
/*
This for the case 0, This is the Menu that will automatically shows up cause
like I said earlier the value of choice from the start without
the user input is 0 that means it will show or output this line of words there
*/
public static void showChoices(){
System.out.println("\n Enter a Number:");
System.out.println("\t Choice options:");
System.out.println("\t 1.Show Items");
System.out.println("\t 2.Add Item");
System.out.println("\t 3.Change Item");
System.out.println("\t 4.Remove Item");
System.out.println("\t 5.Search Item");
System.out.println("\t 6.Quit ");
/*Case 1 doesn't need any input from the user cause it will just show the Items
that the user putted using case 2 to the arraylist I created on the other class*/
/*This is the case 2 thats a function that will add an Item to your ItemArray,
This code will not explain this cause
Id just called a function that will gather input from the user, I will
explain how it works on the other class I created*/
}
public static void addItem(){
System.out.println("Add Item: ");
itemList.additem(scanner.nextLine());
/*This is the case 3 which will change the Item you want, for the case 2 It
will not also explain how to function works but I will explain it later,
This lines of codes will only gather input from the user for the postion of
the item he wants to change and what Item is it
*/
}
public static void changeitem(){
System.out.println("Item Number: ");
int ItemPos = scanner.nextInt();
scanner.nextLine();
System.out.println("New Item: ");
String NewItem = scanner.nextLine();
itemList.changeItem (ItemPos - 1, NewItem);
}
if(itemList.findItem(searchItem) != null){
System.out.println("Found " + searchItem + " in your List");
}
else{
System.out.println(searchItem + " is not your List");
}
}
}
package barilproject;
import java.util.*;
}
return null;
}
}