Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Function Name: flowerPicking Inputs: 1. ( char ) The type of flower to pick 2. ( char ) 1XN string representing an assortment of various

Function Name: flowerPicking

Inputs:

1. ( char ) The type of flower to pick

2. ( char ) 1XN string representing an assortment of various flowers

3. ( double ) 1xN vector that holds how many days each flower has been stored

Outputs:

1. ( char ) A statement on the type of flower and how many you picked

2. ( double ) How many of those flowers were wilted

Banned Functions:

strfind, Conditional Statment(such as if, else, elseif), Iterations (such as while, for)

Topics: ( masking ), ( strings and vectors )

Background:

Valentine's day is coming up and you are trying to secure a date! You have been

following your crush (not creepily) to figure out what type of flowers they would like and alas you

get the answer! With this information you go to the flower shop just to be met with so many

different options it would take forever to find all the right ones, but luckily you remembered to

bring your laptop so MATLAB can save the day!

Function Description:

The desired flower is given as a single letter: r(rose), t(tulip), d(daisy), p(petunia),

and c(carnation) (input 1) . You are also provided with a vector representing the flowers that

exist in the flower shop (input 2). Find how many desired flowers there are in the shop, and

output a sentence in the following format (output 1):

'There are/is of the right

flower(s) in the flower shop'

Then determine how many of the desired flowers are not wilted by identifying the corresponding

days of storage (input 3). Flowers are wilted if they have been stored for 15 days or more.

Output 2 should be the number of unwilted flowers.

Example:

assortment = 'rrtcpdttdpprtd'

stored = [12, 1, 17, 25, 6, 4, 34, 11, 2, 11, 1, 45, 7, 15, 19]

[str, num] = flowerPicking('r', assortment, stored)

str = 'There are/is 3 of the right flower(s) in the flower

shop'

Num = 2

Homework 04 - Masking

Notes:

The vector of days stored will always be the same length as the original flower shop

assortment vector.

The desired flowers will always be lowercase

Please solve using matlab and masking techniques!!! To receive a thumbs up please do not use conditional statements(if,else,elseif) or iterations(for, while) on this problem!!!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Databases Illuminated

Authors: Catherine Ricardo

2nd Edition

1449606008, 978-1449606008

More Books

Students also viewed these Databases questions

Question

5 What are the main aims of talent management?

Answered: 1 week ago