[SOLVED] 代写 html python graph CSE 231

30 $

File Name: 代写_html_python_graph_CSE_231.zip
File Size: 301.44 KB

SKU: 3294327329 Category: Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Or Upload Your Assignment Here:


CSE 231
This assignment is worth 40 points (4.0% of the course grade) and must be completed and turned in
before 11:59 on Monday, February 11 (two weeks because of the first exam). Assignment Overview
In this assignment you will practice with functions and Turtle graphics.
Background
A third of the world’s 195 countries currently have national flags that include religious symbols. Of the 64 countries in this category, about half have Christian symbols (48%) and about a third include Islamic religious symbols (33%). Christianity and Islam are the world’s two largest religious groups.
Christian symbols are found on 31 national flags from Europe, Asia and the Pacific and the Americas. These symbols includes the crosses of St. George, St. Patrick and St. Andrew.
Islamic symbols are found on the flags of 21 countries in sub-Saharan Africa, the Asia-Pacific region, and the Middle East and North Africa. These symbols include an Islamic star and crescent.
This assignment is conceptually simple: draw the flag of four different countries using turtle graphics. The exercise is to use functions. Four (4) countries were chosen among the countries that has Islamic symbols on their flags and located in the two largest continents (Asia and Africa). Even though all these four countries have religious symbols in their flags, they are secular.
Africa
– Tunisia: https://en.wikipedia.org/wiki/Flag_of_Tunisia. The color red represents the blood of
fallen citizens killed during the French conquest of Tunisia in 1881. The white symbolizes peace. The disk symbolizes the radiance of the nation as the sun. The crescent and five-pointed star represent unity of all Muslims and the Five Pillars of Islam, respectively.
– Libya: https://en.wikipedia.org/wiki/Flag_of_Libya. The different colors in the Libyan flag represent the different regions of the country. The crescent stands for the Islam which is the predominant religion in the country. The star is a symbol of the smiling hope of the people of Libya.
Asia
– Turkey: https://en.wikipedia.org/wiki/Flag_of_Turkey. The star is the symbol of the Turkish
nation. The crescent is the symbol of the Islamic faith. The red represents the blood of the
martyrs who died for both.
– Singapore: https://en.wikipedia.org/wiki/Flag_of_Singapore. Although Singapore has a
crescent and stars on its flag, they do not have religious significance. The crescent moon “represents a young nation on the ascendant, and the five stars depict Singapore’s ideals of democracy, peace, progress, justice and equality.”
Below are the specifications for dimensions that are very useful—all dimensions are derived from a specified height (A).
Programming Project #4
Spring 2019

Project Specification
You must use at least the four functions specified below and one function for each country. You are encouraged to use more functions of your own design. For example, I found that it was useful to have a function that drew a circle of stars
Important specification: global variables are not allowed. That is, any variable names used within any function must be parameters or be created in the function.
1. A function to draw a rectangle name rectangle and fills it with the color. rectangle(x,y,length,height,color)
▪ This function accepts as input the starting coordinates of the rectangle, the length and height of the rectangle and the filling color.
▪ Parameters:x(int),y(int),length(float), height (float), color (string)
▪ Returns nothing
2. A function to draw a circle name circle and fills it with the color.
circle(x,y,radius,color)
▪ This function accepts as input the coordinates of the circle, the radius and the filling color.
▪ Parameters:x(int),y(int),radius(float), color (string)
▪ Returns nothing
3. A function to draw a crescent named crescent and fills it with the color. crescent(x1,y1,x2,y2,R1,R2,color1,color2)
▪ Think of a crescent as the difference between two circles.
▪ This function accepts as input the coordinates of the starting point, the radius and the
colors for each circle.
▪ Parameters:x1(int),y1(int),x2(int),y2(int),R1(float),R2(float),color1
(string),color2 (string)
▪ Returns nothing
4. A function to draw a five-pointed star named star and fills it with the color. star(x,y,size,color,theta)
▪ This function draws a rotated five-pointed star. It accepts as input the starting position of the star, its size, its filling color, and the angle of the rotation. Its size is the length of one edge. The angle of rotation will be the argument to turtle.setheading() or turtle.seth() and is the starting point of the lower left point working clockwise.
▪ Parameters:x(int),y(int),size(float),color(string),theta (int)
▪ One way to draw five-pointed star is directing the turtle pointer with angle 72 and 144
interchangeably and forwarding it with the edge size. (360/5 = 72)
▪ Returns nothing
5. Four (4) functions Country_flag to draw a flag of a certain height (“A” from the specifications presented in the background section) according to the official specifications. Replace Country by the specific country name. The exception is in the position and size of stars—following the exact specification of stars and their spacing is not worth the effort so simply making stars look good close the picture and in the right orientation is satisfactory. You

must use the appropriate functions defined above when drawing the flag, e.g. if there is a crescent in your flag, you must call the crescent function. Country_flag(x,y,height)
▪ This function accepts the starting coordinates of the flag and its height ▪ Parameter:height(float)
▪ Returns nothing
6. A function main to interact with the user:
▪ The program should prompt the user to choose between 6 options (capitalization does
not matter) until the user enters ‘Q’:
– – – – – –
▪ The height of all flags should be equal to 240.
▪ If the user chooses one country, then the flag should be drawn in the middle of the
screen starting from position 0,0 as shown in the example output.
▪ If the use choose all countries then all four flags should fit in a screen size, you can find
the width and the height of the window using window_width() and window_height()
functions.
▪ If the user quits, the program should display a goodbye message.
Deliverables
You must use Mimir to turn in the file:
proj04.py – this is your source code solution. Please be sure to use the specified file name.
Notes and Hints:
1. To do turtle graphics refer to https://docs.python.org/3.7/library/turtle.html and you need to import turtle
2. Colors. You may use simple colors, e.g. “red” is the rgb (1,0,0), or you can use the official colors as described on the Wikipedia page. You may also be creative with colors as long as there are the correct stripes and stars, and the correct number of colors per flag.
3. Remember how to get the coordinates of a point of a circle from the radius and angle.
4. Using turtle.speed(100) is helpful to draw fast, but I suggest that you begin with slow
drawing so you can better observe what is happening. Make your TA happy by including
turtle.speed(100) in your final version of your country_flag function.
5. Turtle.reset()is helpful to reset your turtle before trying to draw anything in the screen
6. Turtle.bye()is helpful to close the turtle screen
Example Output:
Select one of the following options:
TUN: Tunisia
‘TUN’ for the Tunisian flag ‘LBY’ for the Libyan flag ‘TUR’ for the Libyan flag
‘SGP’ for the Singaporean flag ‘All’ for all four (4) flags
‘Q’ to quit
▪ If the input is not one of these entries, the program should display an error message.

LBY: Libya
TUR: Turkey
SGP: Singapore
ALL: All flags
Q: Quit
tun
Select one of the following options:
TUN: Tunisia
LBY: Libya
TUR: Turkey

SGP: Singapore
ALL: All flags
Q: Quit
all

Select one of the following options:
TUN: Tunisia
LBY: Libya
TUR: Turkey
SGP: Singapore
ALL: All flags
Q: Quit
q Bye
Grading Rubric
Computer Project #04
General Requirements:
Scoring Summary
( 4 pts) Coding Standard 1-6
(descriptive comments, mnemonic identifiers, format, etc…)
Implementation:
( 3 pts)rectangle function
( 3 pts) circle function
( 5 pts) crescent function
( 5 pts) star function
( 4 pts) Tunisia_flag function
( 4 pts) Libya_flag function
( 4 pts) Turkey_flag function
( 4 pts) Singapore_flag function ( 4 pts) main function

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] 代写 html python graph CSE 231
30 $