Advertisement
Samuel_Berkat_Hulu

LowArrayApp

Mar 29th, 2021
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.06 KB | None | 0 0
  1.  
  2. /**
  3.  * Write a description of class HighArrayApp here.
  4.  *
  5.  * @author (your name)
  6.  * @version (a version number or a date)
  7.  */
  8. public class HighArrayApp
  9. {
  10.     public static void main(String[] args)
  11.     {
  12.         //HingArrayApp
  13.         int maxSize = 100; // array size
  14.         HighArray arr; // reference to array
  15.         arr = new HighArray(maxSize); //create the array
  16.        
  17.         arr.insert(77);  // insert 10 items
  18.         arr.insert(99);
  19.         arr.insert(44);
  20.         arr.insert(55);
  21.         arr.insert(22);
  22.         arr.insert(88);
  23.         arr.insert(11);
  24.         arr.insert(00);
  25.         arr.insert(66);
  26.         arr.insert(33);
  27.        
  28.         arr.display(); //display items
  29.         int searchKey = 35; // search for item
  30.         if(arr.find(searchKey))
  31.         System.out.println("Found " + searchKey);
  32.         else
  33.         System.out.println("Can't find " + searchKey);
  34.        
  35.         arr.delete(00); //delete 3 items
  36.         arr.delete(55);
  37.         arr.delete(99);
  38.        
  39.         arr.display();   //display items again
  40.     }
  41. }
  42.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement