For every plant, there is a growth cycle. The number of days that it takes starting from being a seed and ending in being a fruit is what is called the growth cycle. Write a function that takes a plant's name as an argument and returns its growth cycle (in days). In your program: 1. Input from the user the name of a plant 2. Check if the input is either "strawberry", "cucumber" or "potato", if Yes: 2.1 Call calculate_growth_cycle 2.2. In function calculate_growth_cycle, check over the plant's name: 2.2.1 If strawberry, print "### The life cycle of a strawberry ###" and return 110 2.2.2 If cucumber, print "### The life cycle of a cucumber ###" and return 76 2.2.3 If potato, print "### The life cycle a potato ###" and return 120 2.3 With the growth cycle number returned, your program should print "A seed takes days to reach maturity." If not, your program should print "Your plant is available, please try "strawberry", "cucumber" or "potato" Input potato Output ### The life cycle of a potato ### A seed takes 120 days to reach maturity.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter5: Control Structures Ii (repetition)
Section: Chapter Questions
Problem 20PE: When you borrow money to buy a house, a car, or for some other purpose, you repay the loan by making...
icon
Related questions
Question
For every plant, there is a growth cycle. The number of days that it takes starting from being a seed and ending
in being a fruit is what is called the growth cycle. Write a function that takes a plant's name as an argument and
returns its growth cycle (in days).
In your program:
1. Input from the user the name of a plant
2. Check if the input is either "strawberry", "cucumber" or "potato", if Yes:
2.1 Call calculate_growth_cycle
2.2. In function calculate_growth_cycle, check over the plant's name:
2.2.1 If strawberry, print "### The life cycle of a strawberry ###" and return 110
2.2.2 If cucumber, print "### The life cycle of a cucumber ###" and return 76
2.2.3 If potato, print "### The life cycle a potato ###" and return 120
2.3 With the growth cycle number returned, your program should print "A seed takes <growth_number>
days to reach maturity."
If not, your program should print "Your plant is available, please try "strawberry", "cucumber" or "potato"
Input
potato
Output
### The life cycle of a potato ###
A seed takes 120 days to reach maturity.
Transcribed Image Text:For every plant, there is a growth cycle. The number of days that it takes starting from being a seed and ending in being a fruit is what is called the growth cycle. Write a function that takes a plant's name as an argument and returns its growth cycle (in days). In your program: 1. Input from the user the name of a plant 2. Check if the input is either "strawberry", "cucumber" or "potato", if Yes: 2.1 Call calculate_growth_cycle 2.2. In function calculate_growth_cycle, check over the plant's name: 2.2.1 If strawberry, print "### The life cycle of a strawberry ###" and return 110 2.2.2 If cucumber, print "### The life cycle of a cucumber ###" and return 76 2.2.3 If potato, print "### The life cycle a potato ###" and return 120 2.3 With the growth cycle number returned, your program should print "A seed takes <growth_number> days to reach maturity." If not, your program should print "Your plant is available, please try "strawberry", "cucumber" or "potato" Input potato Output ### The life cycle of a potato ### A seed takes 120 days to reach maturity.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr