SlideShare a Scribd company logo
1 of 1
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.
extra :
Use a random number generator to randomly select the candy
color.

More Related Content

More from dunningblair

Write a three-part PAPER.  Part I  Show or discuss the existing a.docx
Write a three-part PAPER.  Part I  Show or discuss the existing a.docxWrite a three-part PAPER.  Part I  Show or discuss the existing a.docx
Write a three-part PAPER.  Part I  Show or discuss the existing a.docx
dunningblair
 
Write a three to four (3-4) page paper in which the student answer.docx
Write a three to four (3-4) page paper in which the student answer.docxWrite a three to four (3-4) page paper in which the student answer.docx
Write a three to four (3-4) page paper in which the student answer.docx
dunningblair
 
Write a three (3) page paper (750 words) about visiting The MET .docx
Write a three (3) page paper (750 words) about visiting The MET .docxWrite a three (3) page paper (750 words) about visiting The MET .docx
Write a three (3) page paper (750 words) about visiting The MET .docx
dunningblair
 
Write a response to each discussion question. Pick 3.1Top of F.docx
Write a response to each discussion question. Pick 3.1Top of F.docxWrite a response to each discussion question. Pick 3.1Top of F.docx
Write a response to each discussion question. Pick 3.1Top of F.docx
dunningblair
 
Write a response to each discussion question.2.1 AshleyTop.docx
Write a response to each discussion question.2.1 AshleyTop.docxWrite a response to each discussion question.2.1 AshleyTop.docx
Write a response to each discussion question.2.1 AshleyTop.docx
dunningblair
 

More from dunningblair (20)

Write a two paragraph message to post in the Effective Speakers disc.docx
Write a two paragraph message to post in the Effective Speakers disc.docxWrite a two paragraph message to post in the Effective Speakers disc.docx
Write a two paragraph message to post in the Effective Speakers disc.docx
 
Write a three-part PAPER.  Part I  Show or discuss the existing a.docx
Write a three-part PAPER.  Part I  Show or discuss the existing a.docxWrite a three-part PAPER.  Part I  Show or discuss the existing a.docx
Write a three-part PAPER.  Part I  Show or discuss the existing a.docx
 
Write a summary of the fallowing Chapters 4, 5, 7, & 8 from the bo.docx
Write a summary of the fallowing Chapters 4, 5, 7, & 8 from the bo.docxWrite a summary of the fallowing Chapters 4, 5, 7, & 8 from the bo.docx
Write a summary of the fallowing Chapters 4, 5, 7, & 8 from the bo.docx
 
Write a thorough review of gifted education history and policy for t.docx
Write a thorough review of gifted education history and policy for t.docxWrite a thorough review of gifted education history and policy for t.docx
Write a thorough review of gifted education history and policy for t.docx
 
Write a three to four (3-4) page paper in which the student answer.docx
Write a three to four (3-4) page paper in which the student answer.docxWrite a three to four (3-4) page paper in which the student answer.docx
Write a three to four (3-4) page paper in which the student answer.docx
 
Write a three (3) page paper (750 words) about visiting The MET .docx
Write a three (3) page paper (750 words) about visiting The MET .docxWrite a three (3) page paper (750 words) about visiting The MET .docx
Write a three (3) page paper (750 words) about visiting The MET .docx
 
Write a single page-Word document answering the following questions.docx
Write a single page-Word document answering the following questions.docxWrite a single page-Word document answering the following questions.docx
Write a single page-Word document answering the following questions.docx
 
Write a summary of  the fallowing the articleLaden, B. V. (1.docx
Write a summary of  the fallowing the articleLaden, B. V. (1.docxWrite a summary of  the fallowing the articleLaden, B. V. (1.docx
Write a summary of  the fallowing the articleLaden, B. V. (1.docx
 
Write a summary of the fallowing Attachmentsthe discussi.docx
Write a summary of the fallowing Attachmentsthe discussi.docxWrite a summary of the fallowing Attachmentsthe discussi.docx
Write a summary of the fallowing Attachmentsthe discussi.docx
 
Write a small discussion in only 2 pages of the following questions.docx
Write a small discussion in only 2 pages of the following questions.docxWrite a small discussion in only 2 pages of the following questions.docx
Write a small discussion in only 2 pages of the following questions.docx
 
Write a short paper on the followingRelative to all of the issu.docx
Write a short paper on the followingRelative to all of the issu.docxWrite a short paper on the followingRelative to all of the issu.docx
Write a short paper on the followingRelative to all of the issu.docx
 
Write a short (half page) paragraph for each question and be s.docx
Write a short (half page) paragraph for each question and be s.docxWrite a short (half page) paragraph for each question and be s.docx
Write a short (half page) paragraph for each question and be s.docx
 
Write a response to each discussion question. Pick 3.1Top of F.docx
Write a response to each discussion question. Pick 3.1Top of F.docxWrite a response to each discussion question. Pick 3.1Top of F.docx
Write a response to each discussion question. Pick 3.1Top of F.docx
 
Write a response to each discussion question.2.1 AshleyTop.docx
Write a response to each discussion question.2.1 AshleyTop.docxWrite a response to each discussion question.2.1 AshleyTop.docx
Write a response to each discussion question.2.1 AshleyTop.docx
 
write a research about how the immigration system will change, and h.docx
write a research about how the immigration system will change, and h.docxwrite a research about how the immigration system will change, and h.docx
write a research about how the immigration system will change, and h.docx
 
Write a reflective essay about the information down below. Mention a.docx
Write a reflective essay about the information down below. Mention a.docxWrite a reflective essay about the information down below. Mention a.docx
Write a reflective essay about the information down below. Mention a.docx
 
Write a program that opens a local file CDataDirectorydata.txt .docx
Write a program that opens a local file CDataDirectorydata.txt .docxWrite a program that opens a local file CDataDirectorydata.txt .docx
Write a program that opens a local file CDataDirectorydata.txt .docx
 
Write a profile of a member of the United States Senate. Your profil.docx
Write a profile of a member of the United States Senate. Your profil.docxWrite a profile of a member of the United States Senate. Your profil.docx
Write a profile of a member of the United States Senate. Your profil.docx
 
Write a poem,song, or story using the muscles of the lower body.Use .docx
Write a poem,song, or story using the muscles of the lower body.Use .docxWrite a poem,song, or story using the muscles of the lower body.Use .docx
Write a poem,song, or story using the muscles of the lower body.Use .docx
 
Write a paper addressing the following •Identify and research at le.docx
Write a paper addressing the following •Identify and research at le.docxWrite a paper addressing the following •Identify and research at le.docx
Write a paper addressing the following •Identify and research at le.docx
 

Recently uploaded

Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
PECB
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 

Recently uploaded (20)

Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 

In each Pez plastic container of Pez candy, the colors are store.docx

  • 1. 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. extra : Use a random number generator to randomly select the candy color.