Write a program that repeatedly gets integer input from the user until the value 99999 is entered. The program must then print the values the user entered alternating between odd and even values starting with the first odd value as in the examples below. The odd and even values must respectively be in the order they were entered but the overall output will not necessarily be in the order entered. If more odd or even values were entered, the program should continue to print the remaining values after all other odd/even values have been printed in the order they were entered. = Note: You must use Queues to solve this problem: an implementation of the Queue class is given - you do not need to provide your own. You will have the following methods available from the Queue class: Queue), enqueue, dequeue, -peeko), len(), and is_empty(). Note: You must NOT access private data fields of the Queue class, you must NOT create any other built-in collections (e.g. lists, tuples, sets, dictionaries, etc) For example: nput 9 2 9999 3 Enter a number: 9 Enter a number: 3 Enter a number: 5 Enter a number: 7 Enter a number: 2 Enter a number: 8 Enter a number: 99999 8 Result 5

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
9
am
Input
3
5
7
~ 00
2
Write a program that repeatedly gets integer input from the user until the value 99999 is entered. The
program must then print the values the user entered alternating between odd and even values
starting with the first odd value as in the examples below. The odd and even values must respectively
be in the order they were entered but the overall output will not necessarily be in the order entered.
8
If more odd or even values were entered, the program should continue to print the remaining values
after all other odd/even values have been printed in the order they were entered.
Note: You must use Queues to solve this problem: an implementation of the Queue class is given -
you do not need to provide your own. You will have the following methods available from the Queue
class: Queue), enqueue(), .dequeue(), peek(), len(), and.is_empty().
Note: You must NOT access private data fields of the Queue class, you must NOT create any other
built-in collections (e.g. lists, tuples, sets, dictionaries, etc)
For example:
Enter a number: 9
Enter a number: 3
Enter a number: 5
Enter a number: 7
Enter a number: 2
Enter a number: 8
Enter a number: 99999
9
WN6
Result
2
99999 3
857
Transcribed Image Text:9 am Input 3 5 7 ~ 00 2 Write a program that repeatedly gets integer input from the user until the value 99999 is entered. The program must then print the values the user entered alternating between odd and even values starting with the first odd value as in the examples below. The odd and even values must respectively be in the order they were entered but the overall output will not necessarily be in the order entered. 8 If more odd or even values were entered, the program should continue to print the remaining values after all other odd/even values have been printed in the order they were entered. Note: You must use Queues to solve this problem: an implementation of the Queue class is given - you do not need to provide your own. You will have the following methods available from the Queue class: Queue), enqueue(), .dequeue(), peek(), len(), and.is_empty(). Note: You must NOT access private data fields of the Queue class, you must NOT create any other built-in collections (e.g. lists, tuples, sets, dictionaries, etc) For example: Enter a number: 9 Enter a number: 3 Enter a number: 5 Enter a number: 7 Enter a number: 2 Enter a number: 8 Enter a number: 99999 9 WN6 Result 2 99999 3 857
Expert Solution
steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY