Question
Help c++ or java After more than ten years and twenty films building up to the final climax, The Arrangers movie is premiering in cinemas
Help c++ or java
After more than ten years and twenty films building up to the final climax, "The Arrangers" movie is premiering in cinemas today and the ticket line will be long. You are the first of your friends to arrive and there is no more room inside, so you must buy all the tickets. You can only buy one ticket at a time, so if you need more than one, you must go back to the end of the line until you have as many as you need. Each ticket takes exactly one minute to buy. Write a program calculate how many minutes you will spend in line, so you can tell your friends when to arrive. Input from the keyboard a series of positive integers indicating the number of tickets (no more than 12) that each person wants to buy. The second value indicates your initial position in line, starting from "1". Output an integer indicating how many minutes you will be in line until you buy all the tickets. Use a queue data structure. Refer to the sample output below.
Sample Run:
Enter the number of tickets each person wants to buy (12 or less): 2 2 4 1 3
Enter your starting position in line: 3 Wait time: 12 minutes
Name the program: WaitTimeXX.java or WaitTimeXX.cpp, where XX are your initials.
2. After more than ten years and twenty films building up to the final climax, "The Arrangers" movie is premiering in cinemas today and the ticket line will be long. You are the first of your friends to arrive and there is no more room inside, so you must buy all the tickets. You can only buy one ticket at a time, so if you need more than one, you must go back to the end of the line until you have as many as you need. Each ticket takes exactly one minute to buy. Write a program calculate how many minutes you will spend in line, so you can tell your friends when to arrive. Input from the keyboard a series of positive integers indicating the number of tickets (no more than 12) that each person wants to buy. The second value indicates your initial position in line, starting from "1". Output an integer indicating how many minutes you will be in line until you buy all the tickets. Use a queue data structure. Refer to the sample output below. Sample Run: Enter the number of tickets each person wants to buy (12 or less): 2 2 4 1 3 Enter your starting position in line: 3 Wait time: 12 minutes 2. After more than ten years and twenty films building up to the final climax, "The Arrangers" movie is premiering in cinemas today and the ticket line will be long. You are the first of your friends to arrive and there is no more room inside, so you must buy all the tickets. You can only buy one ticket at a time, so if you need more than one, you must go back to the end of the line until you have as many as you need. Each ticket takes exactly one minute to buy. Write a program calculate how many minutes you will spend in line, so you can tell your friends when to arrive. Input from the keyboard a series of positive integers indicating the number of tickets (no more than 12) that each person wants to buy. The second value indicates your initial position in line, starting from "1". Output an integer indicating how many minutes you will be in line until you buy all the tickets. Use a queue data structure. Refer to the sample output below. Sample Run: Enter the number of tickets each person wants to buy (12 or less): 2 2 4 1 3 Enter your starting position in line: 3 Wait time: 12 minutesStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started