Expected Learning Outcomes
- familiarise themselves with at least one high level language programming environment.
- develop a structured and documented computer program.
- understand the fundamentals of object-oriented programming and apply it in computer program development.
- apply the computer programming techniques to solve practical problems.
Introduction
In this request, you are going to develop a Console Drawing Board that runs in the command line environment. User can input commands to generate different patterns in the drawing area.
This is a group request. You need to form a group with 5 to 6 students, and write a Win32 Console Application program called drawing.cpp. This is a text-based drawing board with the following requirements.
System Requirements
When the program starts, the console should display a welcome message, and then the System Menu of the program. User can enter the options of the corresponding actions.1
2
3
4
5
6
7
8
9Welcome Message designed by your group
*** System Menu ***
[1] Start Drawing
[2] Change Board Size
[3] Instructions
[4] Credits
[5] Exit
*******************
Option (1 - 5):
Start Drawing
When the user inputs 1 in the System Menu, an empty drawing board is displayed with a pen in the middle. Then the user controls the pen in the drawing board by inputting commands, until a “QUIT” command is entered.
Drawing Board
The drawing board consists of a square drawing area with a default size 30 x 30. The area is enclosed by a boundary with characters ‘|’ for vertical boundary, ‘-‘ for horizontal boundary, and ‘+’ for the corner.
Pen
The initial location of the pen is in the middle of the drawing area. Then based on the user control, the pen can move within the drawing area. An arrow character is displayed in the drawing area to indicate the current location of the pen.
The pen is represented by different arrow characters according to the direction it is facing. There are 8 available directions, with 45 o each (default is 0, i.e. upward). The corresponding ASCII code in decimal of each arrow is given.
User Control
User can input one or multiple commands at a time to control the action of the pen. You may assume that user always input less than 200 characters each time.
If multiple commands are input, they must be separated by at least one space. The commands are case-insensitive.
The commands are executed one by one in the sequence of user input. When all commands have been executed, the drawing board is refreshed to show the most updated drawings. Then the user can input another set of commands again.
Appropriate error checking on user input of commands is expected. Whenever an error occurs, an error message should be displayed. All remaining commands will be ignored. The drawing board is then refreshed to show the most updated status.
For example, an erroneous input may look like:1
FD 10 RT 90 BK LT 45
Only “FD 10” and “RT 90” are executed because the argument for command “BK” is missing. The last command “LT 45” is ignored and not executed.
Quit
When the user inputs the command “QUIT”, the system prompts for user’s confirmation. If the user inputs ‘y’ or ‘Y’, the system returns back to the System Menu. If the user inputs ‘n’ or ‘N’, the system remains at the drawing board. Other input is not acceptable and the system should ask the user to confirm again.
Change Board Size
When the user inputs 2 in the System Menu, the system displays the current size (length of a side, default is 30). Then the user is allowed to input the new size within the range of 20 to 50, inclusively. After the input, the system returns back to the System Menu.
Instructions
The system displays the instructions for using the console drawing board. After displaying the instruction, the system returns back to the System Menu.
Credits
The system displays the personal particulars (e.g. student name, student ID, class, tutorial group, etc.) of the group members. After displaying the information, the system returns back to the System Menu.
Exit
When the user inputs this option, the system prompts for user’s confirmation. If the user inputs ‘y’ or ‘Y’, the program terminates. If the user inputs ‘n’ or ‘N’, the system returns to the System Menu. Other input is not acceptable and the system should ask the user to confirm again.
Other General Requirements
Meaningful guidelines should be printed to assist with user’s input. Whenever an option is selected, meaningful messages should be displayed.
Suitable checking on user’s input is expected. Appropriate error messages should be printed whenever unexpected situation happens, e.g., invalid input, input out-of-range, etc.
The use of functions (in addition to main function) and classes are expected in your program. Appropriate comments should be added in your source code file.
Creativity and Critical Thinking: other features that you find useful or can enhance the user experience can also be implemented.