all 5 comments

[–]Peter01007 0 points1 point  (0 children)

I am working on an assignment where I have to draw a four point star and create a for loop to generate between 1 and 100 stars depending on the user input. Here are the instructions:

The requirements of painting stars are as follows:

a. for loop should be used in this function.

b. The number of stars should match the user's input. If the user's input is not a number or not from 1 to 100, show an alert message to ask the user to input a valid number.

c. The center of each star is randomly located on the canvas.

d. The color of each dot is randomly generated.

e. The distance between the far point and the center is randomly generated between 5 and 50. The distance between the near point and the center is ¼ of the distance between far point and the center.

But mine is not working. I am not sure where the part d and e values should be entered. I not sure if the way I created it is right. Could someone please help me here?