CSCE121 HOMEWORK 5 solved

$35.00

Category:

Description

5/5 - (1 vote)

1. (10 points) Exercise 7 at the end of Chapter 12. Name your program hw5pr1.cpp.
Use several colors and feel free to be creative!

Draw a two-dimensional house seen from the front, the way a child would: with a door, two
windows, and a roof with a chimney. Feel free to add details; maybe have “smoke” come out of
the chimney.

2. (20 points) Write a program named hw5pr2.cpp to draw a correct Texas flag
using rectangles, closed polylines, and/or polygons (not images). To draw a white
5-pointed star, first do a little trig to calculate the vertices and then map
those points to window coordinates. Note: The official proportions of the Texas
flag are as follows: each colored panel (red, white, and blue) has dimensions
in the ratio 1 to 2, e.g., the blue panel is twice as tall as it is wide.

OPTIONAL EXTRA CREDIT
=====================
3. (10 points) Write a C++/FLTK program that draws a checkerboard with
pieces. The image at

http://upload.wikimedia.org/wikipedia/commons/thumb/b/b6/Draughts.svg/
220px-Draughts.svg.png

should serve as the model for your program. For the checker
pieces, make them white and red, with a black outline, as shown in
the picture. For the board, you will need to create your own Color
objects. Look up the RGB values for “moss green” and “cherry blossom
pink”; use them for the background board like this:

Color moss_green(fl_rgb_color(R,G,B));

Change the color of the green squares to “moss green” and change the
cream-colored squares to “cherry blossom pink.” Name your program
hw5pr3.cpp.