My Nursery
Problem Definition
The Green Plantation Nursery sells the following five flower plants:-
Hibiscus
Unit Price: Rs.100, Colours available: Red, White, Pink, Violet, Orange, Yellow
Rose
Unit Price: Rs.200, Colours available: Red, White, Maroon, Yellow
Marigold
Unit Price: Rs.50, Colours available: Orange, Yellow
Dahlia
Unit Price: Rs.150, Colours available: Red, White, Pink
Lotus
Unit Price: Rs.300, Colours available: Blue, Pink, Yellow
Store these details using appropriate data organization and answer the following questions using a one-time menu option.
- Which flower has maximum colour variations?
- Given a colour name as input, list the names of flowers which has that colour shade.
- Given an amount as input, which all flowers can be bought such that all their colour varieties are purchased?
- List all unique colours - a colour which is available for only one type of flower.
Input Format
For options 1 and 4 the only input is the menu choice (1, and 4 respectively).
For the second and third options, there will be two inputs - menu choice and name of the colour/budget separated by a comma (Eg: - 2,White or 3,1500). Please note that there is no space between the menu value and the name of the colour/budget in the case of options 2 and 3.
An invalid menu value ( a value outside the range 1 to 4) gets the output message "Error".
Output Format
- Option 1 - Flower Name
- Option 2 - Names of flowers, for which the specified colour shade is available. If multiple flowers are available, the names are listed in the same line separated by a single space. If no such flower is available in the given colour, print "None".
- Option 3 - name(s) of flower(s) whose all colour shades can be bought with the given amount. In the case of multiple flowers, the names are listed in the same line separated by a single space. If no flowers can be bought, print the message "None"
- Option 4 - names of unique colours, in separate lines
- Any other number as option - Error
Sample Input1
1
Sample Output1
Hibiscus
Sample Input2
2,Red
Sample Output2
Hibiscus Rose Dahlia
Note
All text messages are case-sensitive.
Comments