Question: Write a function that plots a butterfly pattern (25 pts.) that meets the specifications given below and call it in main. The function should return

 Write a function that plots a butterfly pattern (25 pts.) that

Write a function that plots a butterfly pattern (25 pts.) that meets the specifications given below and call it in main. The function should return its own execution time (20 pts.). Also, the elements on the butterfly should indicate mathematical quadrants (15 pts.). An example of a 10x10 butterfly: 11 3 3 4 4 4 4 22 33 33 33 33 3 1 Execution time of the function: 7.8 ms Fig. 1: An example pattern of 10x10 butterfly with indicated mathematical quadrants double pattern_Butterfly(int n/"int n" denotes the size of the n by n butterfly pattern Your program should give the user 2 options. The first option should provide the butterfly size to be selected by the user (should be n by n). The second option is to determine the butterfly size randomly (again n by n). If the selected number is not 1 or 2, the program should return an error message. (10pts.) write 'l' for user defined size write '2' for random size 3 Erroneous number! Fig. 2: The two options. The first one is the user-defined size. The second one is the randomly generated size. If the user selects "I", the program should force the user to enter only even numbers between 5 and 51 as the size of the butterfly. If the written number does not meet the requirement, error messages like the following figure should be returned. Otherwise, the function that draws the desired pattern must be called. (15 pts.) rite 1 for user defined size Write '1' for user defined size for random size write '2' for randon size pite the size. It should be senesi and an even number write the size. It should be 5n51 and an even number: size should be sencsi The size should be an even number! Fig. 3. Error messages for the inputs out of specification If the user selects "2", the randomly generated size of the butterfly pattern again should be even numbers between 5 and 51. The program should also print the random size and the execution time on the screen. Use the computer's internal clock to control the choice of the seed. (15 pts.) Arite '1' for user defined size Arite '2for randon size Random size:14 Execution time of the function: 12.0 silliseconds

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!