![]() ![]() Public class RunestoneTests extends void test1() Pict.zeroBlue() // Change this to call keepOnlyBlue() KeepOnlyBlue() method sets the blue values at all pixels to zero.Īdd new method here and call it from main. ZeroBlue() method sets the blue values at all pixels to zero String output = "Picture, filename " + getFileName() + * a string with information about the picture such as fileName, * Method to return a string with information about this picture. * Constructor that takes a buffered image * Constructor that takes a picture and creates a let the parent class handle this width and height * height the height of the desired picture * Constructor that takes the height and width let the parent class handle this fileName * fileName the name of the file to create the picture from * Constructor that takes a file name and creates the picture * child constructors always call a parent constructor * not needed but use it to show students the implicit call to super() * Barbara Ericson class Picture extends SimplePicture ![]() * SimplePicture and allows the student to add functionality to Try one of the other images below like metalLion.jpg, water.jpg, kitten.jpg, puppies.jpg, blueMotorcycle.jpg, or student.jpg. Change the method call in main from zeroBlue to keepOnlyBlue to test it. Picture Lab keepOnlyBlue: Using zeroBlue() as a guide, write a method called keepOnlyBlue() that keeps only the blue values by setting the red and green values to zero. You may want to come back to do these questions after Unit 9. The following questions require some knowledge about inheritance which is covered in the next unit, Unit 9. You may notice that the UML class diagram doesn’t look exactly like Java code. ![]() The numbers at the end of the association links give the number of objects associated with an object at the other end.įor example, it shows that one Pixel object has one Color object associated with it and that a Color object can have zero to many Pixel objects associated with it. Association is also called a “has-a” relationship. The straight line links show associations between classes. ![]() The open triangle points to the class that the connected class inherits from. The middle area shows attributes (instance or class variables) and the bottom area shows methods. Each class is shown in a box with the class name at the top. The Picture class inherits attributes and methods from the SimplePicture class and the SimplePicture class implements the DigitalPicture interface as shown in the Unified Modeling Language (UML) class diagram in the figure below.Ī UML class diagram shows classes and the relationships between the classes. You will write methods in the Picture class that modify digital pictures. Picture Lab A5: Modifying a Picture ¶Įven though digital pictures have millions of pixels, modern computers are so fast that they can processĪll of them quickly. 8.9.7 Picture Lab A9: Simple Edge Detection.8.9.6 Picture Lab A8: Creating a Collage.8.9.5 Picture Lab A7: Mirroring Part of a Picture.8.9.4 Picture Lab A6: Mirroring Pictures.8.9.3 Picture Lab A5: Modifying a Picture.8.9.2 Picture Lab A4: 2D Arrays in Java.8.9 College Board Picture Lab and Steganography Lab for 2D Arrays.8.5 Toggle Mixed Up or Write Code Practice.8.2.5 Enhanced For-Each Loop for 2D Arrays (Day 2).8.2.1 Nested Loops for 2D Arrays (Day 1).8.2 Traversing 2D Arrays (nested loops).8.1.5 Set Value(s) in a 2D Array (Day 2).Peer Instruction: 2D Arrays Multiple Choice Questions. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |