600.108 Intro Programming Lab Week 7 PROBLEM: Picture This For lab this week you will use incremental coding to write a class that can be used to create and manipulate digital pictures. We will build on this class in future labs to actually do something, but for now we are just creating a class of the basics. Each picture object will have a height and width measured by (integer) pixels, and a subject matter description. The following instance methods should be available for Picture objects: - Construct one from three parameters which give the width, height, and subject values. - Construct one from a single String parameter in the form: Multiword Description [width,height], such as: "Sleeping Cat [120,230]". The [ , ] format for the size is required. - Return a string representation of a picture, in the same format used above. - Get the area of the picture, in square pixels. - Say if the picture is in landscape mode (true if width >= height). - Say if the picture is in portrait mode (true if height >= width). - Get the perimeter of the picture, in inches (real #), based on the current class resolution value (see the paragraph below). - Compare two pictures based on their perimeters. This method should operate like the compareTo method in the String class. In addition to the instance methods above, there should be a shared class data member which keeps track of the resolution for all pictures, measured as the number of pixels per inch (ppi). This value should be initialized to 64. In other words, one square inch of a picture would be represented with 64x64 pixels. There should also be a class method which can be used to set this resolution to a new (integer) value. (A higher number is for better resolution.) The details of these methods (parameter types, return types and names) should be made clear by the driver program we are giving you so that you can test your class. You can download it from www.cs.jhu.edu/~joanne/cs108/week07.java PHASE 1: Download the posted driver program. Look at it to see how the class you are going to write is used. Write a skeleton of the Picture class. This should have only headers for each of the methods described above. Make sure that the names and parameter lists match how the methods are called in the driver program. Add dummy return values for any method that is supposed to return a value, appropriate to that value's data type (such as return 0 or return false or return null). Get the files to compile together without any errors. (At this point pg07.java should compile, but not produce correct results.) PHASE 2: Add the data members for your class. Fill in the code for the first three methods listed above (constructors and toString). Get these to compile and run properly with the driver program. PHASE 3: Add the code for the next 3 methods listed above (area and modes). Get these to compile and run properly with the driver program. PHASE 4: Add the resolution class (static) data member and the class (static) method to change it. Add the perimeter and compare methods. Compile and run all. PHASE 5: Add complete and correct javadoc comments for all your methods. You should now be done! ************************************************** MAKE SURE YOU DELETE YOUR FILES OFF THE LAB COMPUTER WHEN DONE!!! FAILURE TO DO SO IS AN ETHICS VIOLATION! **************************************************