Question: Planter This is a pair programming exercise! Refer to the Pair Programming resource guide for what this means, and ask your tutor! Download planter.c here

Planter
This is a pair programming exercise! Refer to the Pair Programming resource guide for what this means, and ask your tutor!
Download planter.c here
Or, copy these file(s) to your CSE account using the following command:
1511 fetch-activity planter
Complete the program planter.c! The program is a garden simulator that uses a 2D array, a 5x5 grid, to represent a garden.
The gardener will be represented by the # character and each round will appear on the first column of the row that is about to be planted.
The program should prompt the user to choose which type of flower that will be planted in each row of the garden. The user may also choose to plant nothing, represented by the . character.
Flowers take 3 rounds to bloom after they are planted. During the round, if the flower is still growing, it will be represented by a number that represents how many rounds are left for the flower to bloom. If the flower has already bloomed, it will be represented by the first letter of its name.
The garden should be printed after each round, updating how long is left for the flowers to bloom.
Once all flowers are planted, the program should wait for the growing flowers to bloom, printing Waiting for flowers to bloom... and the garden after each round.
You must use the provided struct garden to represent the flowers in the garden, the print_garden function to display the current state of the garden and the provided enum flowers to represent the different flowers.
Examples
dcc planter.c -o planter ./planter Welcome to the planter! # ........................0. Nothing 1. Daisy 2. Rose 3. Tulip Which Flower would you like to plant in this row? 333333 # ...................0. Nothing 1. Daisy 2. Rose 3. Tulip Which Flower would you like to plant in this row? 022222..... # ..............0. Nothing 1. Daisy 2. Rose 3. Tulip Which Flower would you like to plant in this row? 111111.....33333 # .........0. Nothing 1. Daisy 2. Rose 3. Tulip Which Flower would you like to plant in this row? 2 T T T T T .....2222233333 # ....0. Nothing 1. Daisy 2. Rose 3. Tulip Which Flower would you like to plant in this row? 0 T T T T T .....1111122222..... Waiting for flowers to bloom... T T T T T ..... D D D D D 11111..... Waiting for flowers to bloom... T T T T T ..... D D D D D R R R R R .....
It could be beneficial to first complete the grow_garden function before implementing the main function as it would help you visualise the garden after each turn.
Assumptions/Restrictions/Clarifications
Assume you will only be given valid inputs.
The provided struct garden, enum flowers and print_garden should not be modified.
You may not assume a flower will always be chosen to be planted in a row, the user may choose to plant nothing.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!