Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Can I please see this code written in java according to the specifications below? The middle line should be directly constructed to be pinched on
Can I please see this code written in java according to the specifications below?
The middle line should be directly constructed to be "pinched" on each side. The bottom part should count from the size - 2 down to zero by 2, then for even sizes, add the display of the last line with single stars on each end. Try to implement this without the drawButterfly method. Let me know if this helps. Programming Assignment Repetition In this project you will write an application that will display a butterfly according to the requirements below. All of the butterfly shapes displayed by the program must be geometrically similar shapes, i.e., uniformly scaled, and match those shown in the requirements and described in the paragraphs below. While there could be endless ways to actually "draw" a butterfly, all shapes drawn by your application must resemble the ones shown below exactly as described and shown. First, you should make sure you know how to draw using nested for-loops that display one character per print statement. To bolo vou understand After accurately drawing the butterfly, the program must ask the user if they want another butterfly to be drawn. Accept a string as input using the Scanner's next() method (NOT nextLine()). The user must indicate the desire to draw another butterfly by entering either Yory - either case should be allowed by the application. Any other input will be considered a negative answer and the program will then terminate by printing the termination message shown in the example executions below. Note well that the termination message must include the number of butterflies that were drawn for the user during the entire execution of the program. Note that the word, butterfly, is displayed in its singular when the number drawn was one (1), otherwise the word is displayed in the plural. (Hint: the conditional operator is good for getting this done!) Also, note that your code should be able to display as many butterflies ne the ricor chooses, After accurately drawing the butterfly, the program must ask the user if they want another butterfly to be drawn. Accept a string as input using the Scanner's next() method (NOT nextLine()). The user must indicate the desire to draw another butterfly by entering either Yor y - either case should be allowed by the application. Any other input will be considered a negative answer and the program will then terminate by printing the termination message shown in the example executions below. Note well that the termination message must include the number of butterflies that were drawn for the user during the entire execution of the program. Note that the word, butterfly, is displayed in its singular when the number drawn was one (1), otherwise the word is displayed in the plural. (Hint: the conditional operator is good for getting this done!) Also, note that your code should be able to display as many butterflies ne the rear chooses, many butterflies as the user chooses, and any sizes, including large and small sizes not shown in these example executions. Here are two separate executions of your program. Make sure your output is identical to the following when the sizes are the same. When the sizes entered are different, the drawn shapes should be geometrically similar. EXECUTION EXAMPLE #1: ----ZGRASP exec: java Butterfly I will draw a butterfly for the s ize you enter. Afterward, if you want another, a nswer Y or y. Enter desired butterfly size: 3 Error: Size must be 4 or greater. Enter desired butterfly size: 4 * * *** *** *** **** ** ** -- GRASP exec: Java Butterfly I will draw a butterfly for the s ize you enter. Afterward, if you want another, a nswer Yor y. Enter desired butterfly size: 3 Error: Size must be 4 or greater. Enter desired butterfly size: 4 * ** ** *** *** **** *** ** * Want another butterfly? (Y/y for another): y Enter desired butterfly size: 12 * ** *** *** *** **** ***** *** ** Want another butterfly? (Y/y for another): y Enter desired butterfly size: 7 * *** ***** ***** ** ****** *** ***** ***** *** *** 1 * * Want another butterfly? (Y/y for another): y Enter desired butterfly size: 9 * *** ***** *** * Want another butterfly? (Y/y for another): n Hope you enjoyed your 4 butterfli es. - GRASP. operation complete Step by Step Solution
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