Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner input = new Scanner(System.in);
- System.out.printf("Input the queue size: ");
- int size = input.nextInt();
- Queue que = new Queue(size);
- while (true) {
- System.out.println("\n1. Enqueue\n2. Dequeue\n3. View Queue\n");
- int choice = input.nextInt();
- if (choice == 1) {
- System.out.printf("Value to insert: ");
- int value = input.nextInt();
- que.enqueue(value);
- }
- else if (choice == 2) {
- que.dequeue();
- }
- else if (choice == 3) {
- que.view_queue();
- }
- else {
- break;
- }
- }
- input.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement