Question
Step1-Write a function that plots a butterfly pattern that meets the specifications given below and calls it in main. The function should return its own
Step1-Write a function that plots a butterfly pattern that meets the specifications given below and calls it in main. The function should return its own execution time. Also, the elements on the butterfly should indicate mathematical quadrants. An example of a 10x10 butterfly.
Step2- 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.
Step3- If the user selects “1”, 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.
Step4- 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.
Step by Step Solution
3.45 Rating (152 Votes )
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started