Question
I need help with Java: Creating and exploring other pictures Here is the main method in the class PictureExplorer. Every class in Java can have
I need help with Java:
Creating and exploring other pictures Here is the main method in the class PictureExplorer. Every class in Java can have a main method, and it is where execution starts when you execute the command java ClassName. public static void main( String args[]) { Picture pix = new Picture("beach.jpg"); pix.explore(); } The body of the main method declares a reference to a Picture object named pix and sets that variable to refer to a Picture object created from the data stored in a JPEG file named beach.jpg in the images folder. A JPEG file is one that follows an international standard for storing picture data using lossy compression. Lossy compression means that the amount of data that is stored is much smaller than the available data, but the part that is not stored is data we won't miss. Exercises 1. Modify the main method in the PictureExplorer class to create and explore a different picture from the images folder. 2. Add a picture to the images folder and then create and explore that picture in the main method. If the picture is very large (for instance, one from a digital camera), you can scale it using the scale method in the Picture class. For example, you can make a new picture (smallMyPicture.jpg in the images folder) one-fourth the size of the original (myPicture.jpg) using: Picture p = new Picture("myPicture.jpg"); Picture smallP = p.scale(0.25,0.25); smallP.write("smallMyPicture.jpg");
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