Overview

For this assignment you will be building two main components. A menu system and several drawing routines.

The menu system will operate on a whitelist principle and prompt the user for the type of drawing they want and its size. A whitelist is a list of accepted inputs with anything not on the list rejected.

The drawings will all be ASCII shapes of user specified size.

Menu System

The menu should prompt the user for a command and if it is not a valid command, respond it is invalid and prompt again. The commands it needs to respond include:

The matching for the commands should be case insensitive. That is “Help”, “help”, and “hElP” will all trigger the help command.

Drawings

There are several drawings that your program needs to support

Square

When a square is drawn it will first prompt the user for a size. Valid sizes are 1 through 15 inclusive. An example square of size 5 is

*****
*****
*****
*****
*****

Box

When a box is drawn it will first prompt the user for a size. Valid sizes are 3 through 15 inclusive. An example box of size 5 is

*****
*   *
*   *
*   *
*****

Diagonal Down

When a diagonal down line is drawn, it will first prompt the user for a size. Valid sizes are 3 through 15 inclusive. An example line of size 5 is

*    
*   
 *  
  *
   *

Diagonal Up

When a diagonal up line is drawn, it will first prompt the user for a size. Valid sizes are 3 through 15 inclusive. An example line of size 5 is

    *
  *
 *  
*   
*    

Checkerboard

When a checkerboard drawn, it will first prompt the user for a size. Valid sizes are 5 through 15 inclusive. An example line of size 10 is

* * * * * 
* * * * *
* * * * *
* * * * *
* * * * *
* * * * *
* * * * *
* * * * *
* * * * *
* * * * *

Tips

Example Output

User input is in bold

Please enter a command: bad
Invalid command
Please enter a command: hElP
Acceptable commands: help, quit, square, box, diagonaldown, diaonalup, checkerboard
Please enter a command: square
Please enter a size between 1 and 15: -1
The value -1 is not in a valid range.
Please enter a size between 1 and 15: 16
The value 16 is not in a valid range.
Please enter a size between 1 and 15: 5

*****
*****
*****
*****
*****

Please enter a command: box
Please enter a size between 3 and 15: 2
The value 2 is not in a valid range.
Please enter a size between 3 and 15: 5

*****
*   *
*   *
*   *
*****

Please enter a command: diagonaldown
Please enter a size between 3 and 15: 7

*      
*     
 *    
  *   
   *  
    *
     *

Please enter a command: diagonalup
Please enter a size between 3 and 15: 7

     *
    *
   *  
  *   
 *    
*     
*      

Please enter a command: checkerboard
Please enter a size between 5 and 15: 13

* * * * * * *
* * * * * *
* * * * * * *
* * * * * *
* * * * * * *
* * * * * *
* * * * * * *
* * * * * *
* * * * * * *
* * * * * *
* * * * * * *
* * * * * *
* * * * * * *

Please enter a command: quit

PreviousNext