Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

/ / Keep the step instructions and add your code below them. / * * * Load and draw a picture. * * Step 1

// Keep the step instructions and add your code below them.
/**
* Load and draw a picture.
*
* Step 1: Enter your name for @author and today's date for @version
*
* @author
* @version
*/
public class PictureExpander
{
public static void main(String[] args)
{
// Step 2: Create a picture object pic and load
// picture "beautifulSunset.jpg"
// Declare an object:
Picture pic = new Picture("beautifulSunset.jpg");
// Step 3: Draw the picture
// Call a method on the object:
pic.draw();
// Print a statement indicating where we are in the code
System.out.println("Before translation and grow:");
// Step 4: Complete the statement to
// display the (x, y) coordnates of the picture
System.out.println("X-coordinate: 0");
System.out.println("Y-coordinate: 0");
// Step 5: Complete the statement to
// display the size of the picture
System.out.println("Width : 400");
System.out.println("Height: 300");
// Step 6: Translate the picture 150 to the right
// and 100 units down
// Print a statement indicating where we are in the code
System.out.println("After translation:");
// Step 7: Complete the statement to
// display the (x, y) coordnates of the picture
System.out.println("X-coordinate: 150");
System.out.println("Y-coordinate: 100");
// Step 8: Complete the statement to
// display the size of the picture
System.out.println("Width : 400");
System.out.println("Height: 300");
// Before completing steps 9,10, and 11, compile and run this code
// to see what the translate command did
// Step 9: Enlarge the picture by 100 pixels to the left and right
// and 80 pixels up and down
// Print a statement indicating where we are in the code
System.out.println("After grow:");
// Step 10: Complete the statement to
// display the (x, y) coordnates of the picture
System.out.println("X-coordinate: 100");
System.out.println("Y-coordinate: 80");
// Step 11: Complete the statement to
// display the size of the picture
System.out.println("Width : 600");
System.out.println("Height: 460");
}
}

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

More Books

Students also viewed these Databases questions