Computer Science Project 2 Solution

$30.00 $24.00

General Description: You are to write a program that asks the user for a choice of pattern, and then a choice of size. It will produce, on the screen, a square with the particular pattern of the given size (see examples on separate sheet.) Details: The program will keep repeating until the user chooses to…

Rate this product

You’ll get a: zip file solution

 

Description

Rate this product

General Description: You are to write a program that asks the user for a choice of pattern, and then a choice of size. It will produce, on the screen, a square with the particular pattern of the given size (see examples on separate sheet.)

Details:

  1. The program will keep repeating until the user chooses to quit
  1. There are 4 patterns to choose from: (again, see examples)
      1. a square with a left to right diagonal in which the diagonal is the size of the square
      2. a square with a right to left diagonal in which the diagonal is the size of the square
      3. a square that fills from left to right, using the size of the square as the ‘fill’ character
      4. a square that fills from right to left, using the size of the square as the ‘fill’ character

If the user tries to make an invalid choice, the program should keep asking for a valid choice

  1. There are 9 sizes to choose from: 1 – 9

If the user enters an invalid size, the program should keep asking until a valid size is entered

  1. You MUST use a switch statement in your code for the pattern choice.
  1. You MUST use a do-while loop to repeat the program for the user.
  1. You MAY use functions in your code if you know how, but they are not required.
  1. You must have internal documentation:

See the handout on Documentation Standards

  1. I do NOT want to see 36 different patterns hard-coded into the program!!

You should have one block of code for each pattern which produces the correct pattern and size.

SAMPLE OUTPUT

c

SAMPLE OUTPUT WITH ‘INVALID’ INPUT

Computer Science Project 2 Solution
$30.00 $24.00