Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(MATLAB) -Write a program called candyCreation that creates candy hearts by combining different messages and candy colors. Given 5 candy colors and 5 messages, randomly

(MATLAB)

-Write a program called candyCreation that creates candy hearts by combining different messages and candy colors.

Given 5 candy colors and 5 messages, randomly generate 50 candies and store them each in a structured array.

-Use a for loop to determine the number of candies with the 'Be Mine' messages you created and the number of

RED candies with the 'You Rock' message.

-below is further instuction.

image text in transcribed

Suppose you have been placed in charge of the production of a box of 50 valentine candy conversation hearts. Each heart can be one of five colors and can have one of five messages on the front. The colors are as follows (white, yellow, red, purple, orange) and the messa follows: ges are as listed in the table that Messages Be Mine True Love All Mine BFF You Rock Both color and message are randomly generated with uniform distribution. The program should create 50 candy conversation hearts by assigning each candy piece a message and a color. The color and message should be randomly generated with the results stored in a structure array called hearts with fieldnames message and color. The choices for message are assumed to be in a cell array called messages and the choices for color are assumed to be in a cell array called colors. The program should then calculate the percentage of hearts with the message "Be Mine', then the percentage of hearts that are red and have the message "You Rock*. These should appear in Command Window like below: Be Mine is on xx8 of the hearts created. xxs of the hearts are red and have the message You Rock

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions