Question: Homework 4 (15 points) In this assignment, you will practice doing the following: working with several classes (one class perfile) win loops and conditionals win

Homework 4 (15 points) In this assignment, you
Homework 4 (15 points) In this assignment, you
Homework 4 (15 points) In this assignment, you
Homework 4 (15 points) In this assignment, you
Homework 4 (15 points) In this assignment, you
Homework 4 (15 points) In this assignment, you
Homework 4 (15 points) In this assignment, you will practice doing the following: working with several classes (one class perfile) win loops and conditionals win the Amaylist class, programming by contract Overview The goal of this assignment is to display repetitive graphics patterns in a window. The display port is complete and is in the class View Window (The code in View Window is beyond the scope of this course you don't need to understand what it does). The window features radio button to display different patterns. It also has a command button to change the colors of the patter which is displayed. By right clicking on a patter, the user get the color at the location of the click in a popup window) The patterns are created in the class GraphicsElements, which the claw that you need to complete. The class has three methods to create three patterns the top view of a pile of disks, a checkered board and a Sierpinski triangle (see below for more explanations). The class Graphics clements contains alio other methods to modify the color of these patterns, or to inquire about a color at given location within a pattern Some details The pile or disk It is created in the method public are create The pide should wear the top view of a pile of disks. The number of disks can be anywhere between land NUMBER OF DISKS-100. The number of desistiven by the user to do the input, wie a dialog box (method read Dialog in weseo inputIf the we gives an invalid valor, display or mewage (the OptionPane show Message Dialog) and ask for the entry cho Machama www. the color of the distrito run amly chose. Make sure that the pile of disks is always as big as the window allows Create the disks as Oval objects Store these Ovals in an ArrayList (the larger dusk at the of the list and that Below is an cuample Dan het hoop Number of the ween 1 and 100) OK Cancel ter Checkered bound Tangle Dr Cherboard HHH4 l Trang Change color Changelo The method publle void rotatelor PLODIRAL..coval wraphical should change the colors of the danks in the pile, so that any dink jets the color of the disk on top of it. The top dick gets the color of the bottom disk Modify the colors of the elements of the pile of diskas available in graphicalist). Note that there is no need to return the ArrayList since it is possed as a reference. Any modifications to its content is seen by the caller of the method The method publie color yet.colorit, Array.latcoval rape should return the color in the pile of disks (available in graphics at location. If y) is not in the pile or dinks, the method should return null The checkered board it is created in the method puble Arayathectangle createchenhardt) The board has the shape of a square. The number of rows (number of columm can be anywhere between I NUMBER OF ROWS = 50. The number of rows is given by the set. To do the input, we a dialog box (thod read Dalog in uwcse.io Input). If the set gives an invalid value, display an entor message (use OptionPane show MessageDialog) and ask for the entry again Adjacentuates on the howed should have different colors (one only two colors). Make sure that the board is always as big as the windoww allows. Create the individual squares of the board on Rectangle ohjects Store these Rectangles in an ArrayList and return that is Below is an example GO Orphics with Completakere boudin Tianglo Change.com The method The method poble vale coloratahankaredioard ArrayList diectangle graph) should change the colors of the squares on the board to the other available color For example, if the board is made of blue and yellow squares, a blue square should become yellow and vice vers Update the squares of the board (available in graphics.it) The method puble Colector Checkered int y ArrayListotal grapesiet) atrould return the color on the checkered hound (wvailable in graphical.it) at location (19). 17 (xy) is not on the heart, the method should return null The Sierpikitriangle It is created in the method ) The triangle is created by selecting a number of points in the window. The number of points can be anywhere between 1 and NUMBER OF POINTS - 10000. The number of points is given by the user. To do the input, use dialog box method readinDialog in were so Input). If the series an invalid value, display an error message (ose JOption Pune show MessageDialogland ask for the entry in The algorithers to create the triangle is the following Consider the three points, P. P2 und in the graphic window and a fourth point initially at the location of Pl), as indicated in the drawing below Step 1: Select randomly an integer equal to 1.20) Step 2 that integer isl, love in the ArrayList the location of the point midpoint of Pan Pin the form of a circle centered of radies to the Ovaldas - that neer toe in the Amruys the location of the point Omidpoint of Pad 2 in the form of a circle centered it of radius use the Ovalca if that integer i store in the Amynt the location of the point midpoint of Pad 3 in the form of a circle centered of radio use the Oval . Sup. Select as the new location for and restart from step until you have the number of polis required by the wer) PI P2 P3 Q is the midpoint of (P.P2) 2. is the random number selected All of the Ovale should have the same color. When done finding all of the points, return the ArrayList Below is an example (with 5000 points) NE Co Checkered to Top Change color The method le void changeulorudserpinakile (crnyatovalahati should change the colors of Sierpikiriangle Switch between 3 colors les tropen if the triangle was blue, muike it red, ir it was rud, take it even if it was green make it blue). Update the Ovale of the triangle (available in graphics is by using the Met Color method. The method puble Color Colore Yint at T HYLLORE rapists should return the color of the trumple waluhe in praphics.it) at location le not part of the triangle, the thiethed should return null What you need to do Complete the con Criphicalements. You need to provide exactly the interface listed in that com Sample code Muit is the sample code compiles but doesn't do anything. In every method the return value, delete the line that roadsvetum nall Change this and replace it with your own code vos canto your code method by method. That is once you have write the code of one method, the programe should be able to test toon methode Gophicalement saxa. View Windossava Your program has to be your own. Homework 4 (15 points) In this assignment, you will practice doing the following: working with several classes (one class perfile) win loops and conditionals win the Amaylist class, programming by contract Overview The goal of this assignment is to display repetitive graphics patterns in a window. The display port is complete and is in the class View Window (The code in View Window is beyond the scope of this course you don't need to understand what it does). The window features radio button to display different patterns. It also has a command button to change the colors of the patter which is displayed. By right clicking on a patter, the user get the color at the location of the click in a popup window) The patterns are created in the class GraphicsElements, which the claw that you need to complete. The class has three methods to create three patterns the top view of a pile of disks, a checkered board and a Sierpinski triangle (see below for more explanations). The class Graphics clements contains alio other methods to modify the color of these patterns, or to inquire about a color at given location within a pattern Some details The pile or disk It is created in the method public are create The pide should wear the top view of a pile of disks. The number of disks can be anywhere between land NUMBER OF DISKS-100. The number of desistiven by the user to do the input, wie a dialog box (method read Dialog in weseo inputIf the we gives an invalid valor, display or mewage (the OptionPane show Message Dialog) and ask for the entry cho Machama www. the color of the distrito run amly chose. Make sure that the pile of disks is always as big as the window allows Create the disks as Oval objects Store these Ovals in an ArrayList (the larger dusk at the of the list and that Below is an cuample Dan het hoop Number of the ween 1 and 100) OK Cancel ter Checkered bound Tangle Dr Cherboard HHH4 l Trang Change color Changelo The method publle void rotatelor PLODIRAL..coval wraphical should change the colors of the danks in the pile, so that any dink jets the color of the disk on top of it. The top dick gets the color of the bottom disk Modify the colors of the elements of the pile of diskas available in graphicalist). Note that there is no need to return the ArrayList since it is possed as a reference. Any modifications to its content is seen by the caller of the method The method publie color yet.colorit, Array.latcoval rape should return the color in the pile of disks (available in graphics at location. If y) is not in the pile or dinks, the method should return null The checkered board it is created in the method puble Arayathectangle createchenhardt) The board has the shape of a square. The number of rows (number of columm can be anywhere between I NUMBER OF ROWS = 50. The number of rows is given by the set. To do the input, we a dialog box (thod read Dalog in uwcse.io Input). If the set gives an invalid value, display an entor message (use OptionPane show MessageDialog) and ask for the entry again Adjacentuates on the howed should have different colors (one only two colors). Make sure that the board is always as big as the windoww allows. Create the individual squares of the board on Rectangle ohjects Store these Rectangles in an ArrayList and return that is Below is an example GO Orphics with Completakere boudin Tianglo Change.com The method The method poble vale coloratahankaredioard ArrayList diectangle graph) should change the colors of the squares on the board to the other available color For example, if the board is made of blue and yellow squares, a blue square should become yellow and vice vers Update the squares of the board (available in graphics.it) The method puble Colector Checkered int y ArrayListotal grapesiet) atrould return the color on the checkered hound (wvailable in graphical.it) at location (19). 17 (xy) is not on the heart, the method should return null The Sierpikitriangle It is created in the method ) The triangle is created by selecting a number of points in the window. The number of points can be anywhere between 1 and NUMBER OF POINTS - 10000. The number of points is given by the user. To do the input, use dialog box method readinDialog in were so Input). If the series an invalid value, display an error message (ose JOption Pune show MessageDialogland ask for the entry in The algorithers to create the triangle is the following Consider the three points, P. P2 und in the graphic window and a fourth point initially at the location of Pl), as indicated in the drawing below Step 1: Select randomly an integer equal to 1.20) Step 2 that integer isl, love in the ArrayList the location of the point midpoint of Pan Pin the form of a circle centered of radies to the Ovaldas - that neer toe in the Amruys the location of the point Omidpoint of Pad 2 in the form of a circle centered it of radius use the Ovalca if that integer i store in the Amynt the location of the point midpoint of Pad 3 in the form of a circle centered of radio use the Oval . Sup. Select as the new location for and restart from step until you have the number of polis required by the wer) PI P2 P3 Q is the midpoint of (P.P2) 2. is the random number selected All of the Ovale should have the same color. When done finding all of the points, return the ArrayList Below is an example (with 5000 points) NE Co Checkered to Top Change color The method le void changeulorudserpinakile (crnyatovalahati should change the colors of Sierpikiriangle Switch between 3 colors les tropen if the triangle was blue, muike it red, ir it was rud, take it even if it was green make it blue). Update the Ovale of the triangle (available in graphics is by using the Met Color method. The method puble Color Colore Yint at T HYLLORE rapists should return the color of the trumple waluhe in praphics.it) at location le not part of the triangle, the thiethed should return null What you need to do Complete the con Criphicalements. You need to provide exactly the interface listed in that com Sample code Muit is the sample code compiles but doesn't do anything. In every method the return value, delete the line that roadsvetum nall Change this and replace it with your own code vos canto your code method by method. That is once you have write the code of one method, the programe should be able to test toon methode Gophicalement saxa. View Windossava Your program has to be your own

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 General Management Questions!