Question: Develop a Java program that simulates the above scenario. = = = = = = = = = = = = = = = =
Develop a Java program that simulates the above scenario.
NOTE : 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 : For this problem, you're using a Pez dispenser that has room for up to candies.
Input Data:
Enter up to strings representing the allowed candy colors
at the keyboard or
from a data file
Example :
Pink
Orange
Yellow
Green
Yellow
Yellow
Red
Pink
Pink
Pink
Yellow
Green
Example :
Red
Pink
Orange
Green
Yellow
Pink
Pink
Yellow
Pink
Yellow
Green
Red
Example :
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 yellowcolored 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 yellowcolored 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 nonallowed candy colors
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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
