This program was created by first writing 4 methods; the 3 required methods (get Growth, get Days, get Height) and a method for printing the menu. With this as the basis, the program was enhanced by adding other necessary lines of code in an ordered manner. Related lines of code were grouped into new methods. Then the main program was completed so that it would run continuously until the user quit.
The methods were called at the relevant places and other necessary code such as code for error checking was added to complete the program and to allow it to function properly. Due to the structured writing of the code only one minor difficulty was encountered in the process of constructing this program. This was, allowing the user to enter their choice and having to accept it in both uppercase and lowercase letters. Doing this in a switch-case statement was not straightforward. However after referring to this in a book, the problem was easily solved. After the program was written it had to be tested to ensure that it was working correctly.
This was done by using both valid and invalid test data. Although this program is fairly efficient it is possible to enhance it to make it more functional. This can be done, by including more options in the menu allowing the user to perform more calculations on the sunflowers. In addition to that, the user friendliness features can be improved to allow the user to understand how the program is functioning. For example, telling the user exactly what he or she is allowed to enter would help the user to use the program more efficiently. By telling the user he can only enter a value between 1 and 50 for the days of growth for the sunflower, the user will know exactly what to enter and will know why an incorrect value is not accepted.
Other alterations to this program would be better error checking and validation functions. Having separate functions for error checking and validating would be useful because if the program is modified these functions can be used in the rest of the program if necessary. For example if there are several instances in the program where a value has to be within a certain range, the lower bound, upper bound and the value can be sent to the function where it will be checked and a Boolean value can be returned to say whether it is valid or not. Although this is not necessary, it would be useful if the program were to be modified.
Currently the program should be able to cope well with any additions as it generally consists of several methods that are simply being called in the main menu. Since they are not part of the main program they can be removed or edited independently therefore causing fewer changes to the main program. New methods can easily be added and called in the main program without have to make many changes.