2.7k views
3 votes
Describe, using a top-down approach, how you would create a program to draw a white snowflake on a blue background that uses random numbers, so the snowflake will be unique every time you run the code. You don't need to write the exact code or blocks that you would use, but you should describe what functions you would need to create, where you would or would not use loops, and where you would or would not use random numbers.

2 Answers

6 votes

Answer:

too explanation

Explanation: In making snowflakes there are several functions, including:

1. drawBackground

2. drawSnowflake

3. drawMainbranches (size)

4. drawSidebranches (sideNum)

The drawSnowflake function will have the size and control of the size of the snowflake and branchNum to control the number of branches.

Inside drawSnowflake there will be a loop that will be repeated until it is the same as the branchNum parameter.

Inside the for loop I call mainBranches. The main branch function will call the drawsidebranches function and use random numbers as parameters. I can use a random number in a function call to drawSnowflake to control the size and number of branches of each snowflake.

Detail :

Grade : Senior High

Subject: business

User Edu Costa
by
5.2k points
3 votes

Answer:

(see Explanation)

Step-by-step explanation:

TO create a snowflakes I would use several functions, including: drawBackground, drawSnowflake,drawMainbranches(size) and drawSidebranches(sideNum). The drawSnowflake function would have paramenter of size and controlling size of the snowflakeand the branchNum to control the number of branches. Inside drawSnowflake there would be for loop that would repeat until it equaled the branchNum parameter.Inside the for loop I would call mainBranches. The mainBranches funtion would call drawsidebranches function and use random number as a parameter.I could use a random number in the function call to drawSnowflake to control the size and amount of branches of each snowflake.

User Dan Barzilay
by
5.3k points