Answered You can hire a professional tutor to get the answer.

QUESTION

CSCI 1470 Lab 12 Out-of-Class Assignmen Topic: 1-D Array Reading: Chapter 7 Write a C++ program that will draw/process a set of solid rectangles.

CSCI 1470 Lab 12 Out-of-Class Assignmen

Topic: 1-D Array

Reading: Chapter 7

Write a C++ program that will draw/process a set of solid rectangles. The program will prompt the user for the number of rectangles to process. Important requirements for this program are as follows:

a. The maximum number of rectangles to process is 15. 

b. Your program will use default white color for each even numbered rectangle, while each odd numbered rectangle is colored blue. Rectangle are numbered in the order they are created, starting with 0 (i.e., same as the object number associated with each rectangle).

Example Input for this example is shown below:

Image

Example output is shown below. 

Rectangle # 0 (white default Color)

Rectangle # 1 (blue Color (0, 255, 0)

Rectangle # 2 (white default Color)

Your program will prompt the user for the following input data:

1. Number of rectangles to display

2. The width & height to be applied to all rectangles.

3. The upper left x/y coordinate for each rectangle (Parallel arrays should be used for these).

Use the following functions when implementing this program

void getData(int rects_x[], int rects_y[], int& no_rects, int& width, int& height);

Prompts the user for the number of rectangles, the width/height to be applied to all rectangles, and the upper left x/y coordinate for each rectangle. The x/y coordinates for the multiple rectangles are stored in the parallel arrays rects_x and rects_y.

void drawRectangles(int rects_x[], int rects_y[], int rects[], int no_rects, int width, int height);

Draws each rectangle based on the width/height and coordinate information in the parallel arrays. The object number (obj_no) for each rectangle is stored in parallel array rects. Color every odd colored rectangle to blue (0, 0, 255).

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question