Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Task-1 : Modify the above program to implement a QUEUE in a bank as depicted by the following sample output: i. Provide the menu as

image text in transcribed
image text in transcribed
Task-1 : Modify the above program to implement a QUEUE in a bank as depicted by the following sample output: i. Provide the menu as shown below. Run the program in a loop; stop when user opts 4. ii. Add a customer should add an int at the end using the method addLast(). iii. Remove a customer should delete the int at front using the method removeFirst(). iv. Show the queue should display the queue using the method System.out.println(). Queueina Bank 1. Adkl a customer 2. Remove a customer 3. Show the queue 4. Exit Your choice? Added customer1 Qucus in a Bank Queueina Bank 1. Add a customer 2. Remove a customer. Add a customer 3. Show the queue 2. Remove a customer 4. Exit 3. Show the queue 4. Exit Your choice? Your choice?! Added customer #2 Added customer #3 Queueina Bank Qucus ina Bank 1. Add a customer 1. Add a customer 2. Remove a customer 2. Renwave a customer 3. Show the queue 3. Show the queue 4. Exit 4. Exit Your choice? 2 Your choice? 3 Removed customer #1 Queue 1,2,3 Queue - 2.3 Page 3 of 3 3. 14. 18. 19. Exercise #1: Edit, compile and run the following code in NetBeans. TestArrayList.java 1. import java.io.*; 2. import java.util.*; 4. class TestArrayList { 5. public static void main(String[] ar) { 6. ArrayList listi = new ArrayList(); 7. list1.add(new Integer (4)); 8. list1.add(new Integer (5)); 9. list1.add(new Integer (6)); 10. list1.add(new Integer (4)); 11. ArrayList list2 = new ArrayList(4); 12. list2.add(new Integer(3)); 13. list2.add(new Integer (4)); list2.add new Character('a')); 15. list2.add(new Double(1.1)); 16. System.out.println(list1); 17. System.out.println(list2); list1.removeAll(list2); 11 difference: (4, 5, 6, 4], [3, 4, a, 1.1] ==> (5, 6] 20. System.out.println(listi); 21. list1.add(0, new Integer (4)); 22. list1.add(new Integer(4)); list1.retainAll(list2); 24. Il intersection: [4, 5, 6, 4), (3, 4, a, 1.1] ==> (4, 4] System.out.println(listi); 26. list1.add(1, new Integer (5)); 27. list1.add(2, new Integer (6)); list1.addAll(list2); 1/ union: [4, 5, 6, 4], [3, 4, a, 1.1]==> [4,5,6,4,3,4, a, 1.1] System.out.println(listi); List list3 = list1.subList(2,5); System.out.println(list3); 17 (6, 4, 3] list1.set(3, new Integer (10)); // update list1 and lists 35. System.out.println(listi); // [4, 5, 6, 10, 3, 4, a, 1.1] 36. System.out.println(list3); // 16, 18, 3] list3.clear(); 38. System.out.println(listi); // [4, 5, 4, a, 1.1] 39. System.out.println(list3); // 1 } 41. 23. 25. 28. 29. 30. 31. 32. 33. 34. 37. 40

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Microsoft Visual Basic 2017 For Windows Web And Database Applications

Authors: Corinne Hoisington

1st Edition

1337102113, 978-1337102117

Students also viewed these Databases questions

Question

Factor the expression completely, if possible. 9x - 4y

Answered: 1 week ago