# Create a function which will return a string with the color of the next M&M.

INSTRUCTIONS TO CANDIDATES

General Instructions: Design a flowchart and Pseudo code for an application which will sort and count M&Ms according to the rules and logic below. • You are only allowed to use topics discussed in the book up to Chapter 6. You cannot use arrays! • The user must select three colors to count before the loop starts. You must prompt the user for each color. Assume the user will NOT enter the same color more than once. You do not have to write code to prevent this. • There are random number of M&Ms in the bin you are counting, between 1 and 200 M&Ms • You have to count all of the M&Ms in a single pass (loop). This means you can NOT go through the pile once, picking out a single color, then start over and count a different color.

Defined Values: Use the following values for the possible M&M colors: • "Red" • "Green" • "Yellow" • "Brown" • "Blue"

GetNextMM Function: Create a function which will return a string with the color of the next M&M.

Process Steps: 1) Prompt the user for the name of the three colors they would like to count. 2) Count the number of each color of M&Ms using the method you decide works best. This will be some type of loop. When finished, you should have a count for each of the five colors, separately by color. 3) After all M&Ms are counted, print “Selected Colors: “and the names of the three selected colors and the M&M count for only the three colors. 4) Display “Colors Not Selected: “ and the count and color of M&Ms that were not one of the three selected colors.

Example of Output:
Selected Colors:  Red 15  Blue 25  Yellow 10
Colors Not Selected:  Brown 17  Green 12   NOTE: Use Functions /Modules to reduce the amount and complexity of code. Deductions will be taken if you do not use

Process Steps: 1) Prompt the user for the name of the three colors they would like to count. 2) Count the number of each color of M&Ms using the method you decide works best. This will be some type of loop. When finished, you should have a count for each of the five colors, separately by color. 3) After all M&Ms are counted, print “Selected Colors: “and the names of the three selected colors and the M&M count for only the three colors. 4) Display “Colors Not Selected: “ and the count and color of M&Ms that were not one of the three selected colors.

Example of Output:
Selected Colors:  Red 15  Blue 25  Yellow 10
Colors Not Selected:  Brown 17  Green 12   NOTE: Use Functions /Modules to reduce the amount and complexity of code. Deductions will be taken if you do not use

## Related Questions

##### . Introgramming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma

##### . The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

##### . Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual

Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th

##### . SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

##### . Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

Hire Me

Hire Me