Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package my1darray_paulinoh;
- import java.io.*;
- import java.util.Arrays.*;
- public class My1DArray_PaulinoH {
- BufferedReader input = new BufferedReader (new InputStreamReader(System.in));
- int num[] = new int [5];
- static int val, item;
- static String p;
- public int insertItem() throws IOException
- {
- System.out.print("Enter Value: ");
- val = Integer.parseInt(input.readLine());
- return val;
- }
- /*public int findLocationInsert()
- {
- }
- public int deleteItem()
- {
- }
- public int findLocationDelete()
- {
- }*/
- public static void main(String[] args) throws IOException {
- BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
- My1DArray_PaulinoH arr = new My1DArray_PaulinoH();
- //Options
- System.out.println("What would you like to be performed?");
- System.out.println("1.) Insert a value.\n2.) Delete a value.\n3.) Traverse array.\n4.) Exit.");
- System.out.println("Enter number:");
- p = input.readLine();
- if(null == p)
- System.out.println("Error. Try again.");
- else switch (p)
- {
- case "1":
- System.out.println("You picked Option 1. ");
- val = arr.insertItem();
- break;
- case "2":
- System.out.println("You picked Option 2. ");
- //arr.deleteItem();
- break;
- case "3":
- System.out.println("You picked Option 3. ");
- //arr.traverse();
- break;
- case "4":
- System.out.println("You picked Option 4. ");
- System.out.println("Thank you for using our service. Goodbye.");
- System.exit(0);
- default:
- System.out.println("Error. Try again.");
- break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement