| 9 | |
| 10 | |
| 11 | public class Demo |
| 12 | { |
| 13 | public static void main(String[] args) |
| 14 | { |
| 15 | Scanner scan = new Scanner(System.in); |
| 16 | |
| 17 | Heap h = new Heap(20); |
| 18 | |
| 19 | int choice,value; |
| 20 | |
| 21 | while(true) |
| 22 | { |
| 23 | System.out.println("1.Insert"); |
| 24 | System.out.println("2.Delete root"); |
| 25 | System.out.println("3.Display"); |
| 26 | System.out.println("4.Exit"); |
| 27 | System.out.print("Enter your choice : "); |
| 28 | choice = scan.nextInt(); |
| 29 | |
| 30 | if(choice==4) |
| 31 | break; |
| 32 | |
| 33 | switch(choice) |
| 34 | { |
| 35 | case 1: |
| 36 | System.out.print("Enter the value to be inserted : "); |
| 37 | value = scan.nextInt(); |
| 38 | h.insert(value); |
| 39 | break; |
| 40 | case 2: |
| 41 | System.out.println("Maximum value is " + h.deleteRoot()); |
| 42 | break; |
| 43 | case 3: |
| 44 | h.display(); |
| 45 | break; |
| 46 | default: |
| 47 | System.out.println("Wrong choice"); |
| 48 | } |
| 49 | } |
| 50 | scan.close(); |
| 51 | } |
| 52 | } |
nothing calls this directly
no outgoing calls
no test coverage detected