Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am having trouble figuring out how to write this program in java. Would I be able to see this program written in java so

I am having trouble figuring out how to write this program in java. Would I be able to see this program written in java so that I can use it as a guide for the other homework assignments of this type I have? The assignment / requirements are described in pics 1 - 9 (attached).
I am also somewhat unsure of how "IPO format" is formatted, as described in pic # 10 below. Would I be able see this program written in this format, so I am more clear on this?
Thank you so much!
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
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 help you understand this, the following are examples of applications that do exactly that. You should download these examples, study them, know how they work, change them, re-run them, and see/understand how you made them do something a bit different than the original. You will be making a mistake if you skip over these examples for two reasons: 1) these examples show you how your application must be designed and 2) these examples constitute a basis for the requirements for this assignment. The butterfly drawing application will display an introduction (see examples of execution below) and then ask the user for the size of the first butterfly to be drawn. The minimum size is four (4). The application MUST use a while loop to continue asking the user for the size as long as the entered size is less than the minimum (see examples of execution below). As you learned from the two examples above, an input like the butterfly size gives you all of the information you will need to calculate the numbers of asterisks and spaces needed for each line. The input also drives the number of lines in the figure: each butterfly has size lines from the top line through the indented or "pinched" line, then size/2 lines after that. If you did not do so, study the above examples to see how they determine numbers of characters, spaces, and lines using just one input or named constant. 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 butterflieschowcos chooses, 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 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: --J GRASP 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 * * *** ** *** *** **** ** 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 ** ** *** ****** ** ********** ***** *** *** * Want another butterfly? (Y/y for another): *** * 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. EXECUTION EXAMPLE #2: ----J GRASP exec: java Butterfly I will draw a butterfly for the si ze you enter. Afterward, if you want another, an swer Y or y. Enter desired butterfly size: 8 ** ** *** ** * Want another butterfly? (Y/y for a nother): n Hope you enjoyed your 1 butterfly. - GRASP: operation complete. When ever possible, strive to organize your program according to the IPO plan: Input, Processing, Output. This means that after declaring all of your variables, you have three sections of code: 1. Input Section: here you do all the prompting of the user and reading all of the required inputs storing each input in a variable. 2. Processing Section: in this section all calculations are done in the proper order and all results, both intermediate and final results, should be stored in variables. 3. Output Section: This section is the only section that outputs results. All results are output in this section. In fact, all required output (except for input prompts) is contained only in this section. Each section should begin with a single blank line, a brief comment stating the kind of section that is about to begin and then all of the

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Support For Data Mining Applications Discovering Knowledge With Inductive Queries Lnai 2682

Authors: Rosa Meo ,Pier L. Lanzi ,Mika Klemettinen

2004th Edition

3540224793, 978-3540224792

More Books

Students also viewed these Databases questions

Question

10. Describe the relationship between communication and power.

Answered: 1 week ago