Question: Develop a Java program that simulates the above scenario. = = = = = = = = = = = = = = = =

Develop a Java program that simulates the above scenario.
================================================================================================
NOTE 1: For this problem, we're assuming that candies in a Pez dispenser are based on the following colors:
Green, Yellow, Red, Pink, and Orange.
NOTE 2: For this problem, you're using a Pez dispenser that has room for up to 12 candies.
================================================================================================
Input Data:
Enter up to 12 strings (representing the allowed candy colors)
at the keyboard or
from a data file
Example 1:
Pink
Orange
Yellow
Green
Yellow
Yellow
Red
Pink
Pink
Pink
Yellow
Green
Example 2:
Red
Pink
Orange
Green
Yellow
Pink
Pink
Yellow
Pink
Yellow
Green
Red
Example 3:
Red
Pink
Blue
Green
Yellow
Purple
Pink
Yellow
Pink
Yellow
Green
Red
Processing:
Set up an algorithm and step through it to ensure it solves the problem
Use the Stack ADT and the array implementation we went through in class to set up your Java solution
Output Data:
Echo back the input data, along with your output data (if any).
Use a format similar to what you see in the following examples to do the outputting:
Here's the input list:
Pink, Orange, Yellow, Green, Yellow, Yellow, Red, Pink, Pink, Pink, Yellow, Green
Here's the output, after removing the yellow-colored candies:
Pink, Orange, Green, Red, Pink, Pink, Pink, Green
Here's the input list:
Red, Pink, Orange, Green, Yellow, Pink, Pink, Yellow, Pink, Yellow, Green, Red.
Here's the output, after removing the yellow-colored candies:
Red, Pink, Orange, Green, Pink, Pink, Pink, Green, Red
Here is he input list you entered:
Red, Pink, Blue, Green, Yellow, Purple, Pink, Yellow, Pink, Yellow, Green, Red
Error -- The input list includes non-allowed candy color(s).
The only allowed candy colors are:
Green, Yellow, Red, Pink, and Orange.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!