Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.yahoo.hlctt;
- import java.util.ArrayDeque;
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- int coke = 0;
- Scanner sc = new Scanner(System.in);
- System.out.println("Do you have some Coke?");
- coke = sc.nextInt();
- doubleCola(coke);
- }
- public static void doubleCola(int n) {
- ArrayDeque<String> queue = new ArrayDeque<String>();
- queue.add("Sheldon");
- queue.add("Leonard");
- queue.add("Volovitc");
- queue.add("Kutrapalli");
- queue.add("Penny");
- for (int i = 0; i < n; i++) {
- String temp;
- temp = queue.pop();
- queue.add(temp);
- queue.add(temp);
- }
- System.out.println(queue);
- }
- }
Add Comment
Please, Sign In to add comment