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 files to your CSE account using the following command:
fetchactivity planter
Complete the program planter.c The program is a garden simulator that uses a D array, a x 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 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 printgarden 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! # Nothing Daisy Rose Tulip Which Flower would you like to plant in this row? # Nothing Daisy Rose Tulip Which Flower would you like to plant in this row? # Nothing Daisy Rose Tulip Which Flower would you like to plant in this row? # Nothing Daisy Rose Tulip Which Flower would you like to plant in this row? T T T T T # Nothing Daisy Rose Tulip Which Flower would you like to plant in this row? T T T T T Waiting for flowers to bloom... T T T T T D D D D D 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 growgarden function before implementing the main function as it would help you visualise the garden after each turn.
AssumptionsRestrictionsClarifications
Assume you will only be given valid inputs.
The provided struct garden, enum flowers and printgarden 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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
