Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help me about draw star method of US flag. thank you. Next, draw a filled blue rectangle (starfield). The starfield's height should be equal

image text in transcribed

Please help me about draw star method of US flag. thank you.

Next, draw a filled blue rectangle (starfield). The starfield's height should be equal to the stripe height times the number of red stripes. Given this height, the starfield's width should be proportional to the flag (starfield height x (base width/ base height). Calculate using exact arithmetic but round to the nearest integer. Finally, we will draw white stars. Each star will be defined by its own upper left x, y, width and height and will be drawn as line segments in a similar manner as done by hand: frorm the bottom 1/5 of the way from the left to 2/5 of the way from the top on the right, straight across to the left, down to the bottom 1/5 of the way from the right, up to the top center, and down to the starting point. Round to the nearest integer Your program should draw stars using the first of these configuration rules that works: (1) a rectangular grid of stars whose number of columns is greater than the number of rows but less than two times the number of rows (the 6x4 or 8x6 flags), or two interleaved grids of stars in a checkerboard pattern. Either (2) the number of rows and columns of the grids are equal, but the number of rows and columns of the second grid is one less than the first (the first flag of 3x3 and 2x2 13 stars). Or, (3) the number of rows of the first grid is one less than the number of columns of the first grid, and the number of rows of the second grid is one less than that (the current flag of 6x5 and 5x4 stars). Divide the starfield evenly into boxes (no extended size of the last star) and draw the stars according to the formula. Each box should be square, and the boxes should be centered horizontally and vertically in the starfield. If your program can't find a good configuration, it should leave the starfield empty Next, draw a filled blue rectangle (starfield). The starfield's height should be equal to the stripe height times the number of red stripes. Given this height, the starfield's width should be proportional to the flag (starfield height x (base width/ base height). Calculate using exact arithmetic but round to the nearest integer. Finally, we will draw white stars. Each star will be defined by its own upper left x, y, width and height and will be drawn as line segments in a similar manner as done by hand: frorm the bottom 1/5 of the way from the left to 2/5 of the way from the top on the right, straight across to the left, down to the bottom 1/5 of the way from the right, up to the top center, and down to the starting point. Round to the nearest integer Your program should draw stars using the first of these configuration rules that works: (1) a rectangular grid of stars whose number of columns is greater than the number of rows but less than two times the number of rows (the 6x4 or 8x6 flags), or two interleaved grids of stars in a checkerboard pattern. Either (2) the number of rows and columns of the grids are equal, but the number of rows and columns of the second grid is one less than the first (the first flag of 3x3 and 2x2 13 stars). Or, (3) the number of rows of the first grid is one less than the number of columns of the first grid, and the number of rows of the second grid is one less than that (the current flag of 6x5 and 5x4 stars). Divide the starfield evenly into boxes (no extended size of the last star) and draw the stars according to the formula. Each box should be square, and the boxes should be centered horizontally and vertically in the starfield. If your program can't find a good configuration, it should leave the starfield empty

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Temple Of Django Database Performance

Authors: Andrew Brookins

1st Edition

1734303700, 978-1734303704

More Books

Students also viewed these Databases questions

Question

9. Describe the characteristics of power.

Answered: 1 week ago

Question

10. Describe the relationship between communication and power.

Answered: 1 week ago