python program

profilesas70
Number04Chapter03.docx

CS 222 02

Programming Assignment 04 Chapter 03

20 Points

Due: Wednesday, March 21, 2018

In each Pez plastic container of Pez candy, the colors are stored in random order. Frank’s little brother, Phil, likes only the yellow ones, so he painstakingly takes out all the candies one by one, eats the yellow ones, and keeps the others in order, so that he can return them to the container in exactly the same order as before – minus the yellow candies. Write a program to simulate this process. You are REQUIRED TO USE A STACK TO SOLVE THIS PROBLEM. Use the following colors for the candy: Red, Yellow, Blue, Orange, Purple. Figure out how to determine the color order. Display the candy colors as they come out of the Pez dispenser and as they are put back.

Add the following comments to the beginning of the program.

Name: Your Name

Class and Section: CS 222 02

Assignment: Program Assignment 04

Due Date: See above

Date Turned in:

Program Description: You write a short description of what the program will do

When you complete the program, do the following.

1. Turn in a printout of the source code

2. Create a folder with the following name: Program 04

3. Copy your program and any related files to this folder

4. Copy the folder to the following location: I:\kopp\inbox\CS 222 02\your name where your name is a folder located in I:\kopp\inbox\CS 222 02.

Extra Credit: 5 points

Use a random number generator to randomly select the candy color.