9 public class PictureViewer 10{ public static void main(String[] args) { // Step 2: Fix the syntax errors and submit it // // Note: Do not add or remove any statements 11 12 13 to Codecheck to pass the test. 14 15 // Do not change the semantics of each statement Do not add or remove any variables Do not add or remove any objects Magic numbers are allowed 16 17 // 18 19 // 20 // Create an object of Picture by loading an image Picture pic Picture("starry_night.png"); 21 22 23 // Display the width and height System.out.println("Width : " + pic.getWidth()); System.out.println("Height: 24 25 + pic.getHeight()); %3D 26 27 // Increase the width by 50 on both sides and // increase the height by 40 on both sides. //Must use dw and dh when calling method grow(). int dw, dh = 40; pic.grow(dw, dh); 28 29 30 31 32 33 // Display the width and height System.out.println("Width : System.out.println("Height: " + pic.getHeight()); 34 + pic.getWidth()); 35 36 37 // Draw the picture draw(); 38 39 40 // Display the x and y coordinates of the top-left 41

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
are allowed
20
// Create an object of Picture by loading an image
Picture pic = Picture("starry_night.png");
21
22
23
// Display the width and height
System.out.println("Width :
System.out.println("Height:
24
25
+ pic.getWidth());
+ pic.getHeight());
26
27
// Increase the width by 50 on both sides and
// increase the height by 40 on both sides.
// Must use dw and dh when calling method grow().
int dw, dh = 40;
pic.grow(dw, dh);
28
29
30
31
32
33
// Display the width and height
System.out.println("Width :
System.out.println("Height:
34
+ pic.getWidth());
+ pic.getHeight());
35
36
37
//Draw the picture
draw();
38
39
40
// Display the x and y coordinates of the top-left
//
System.out.printilne("X-coordinate: "
System.out.printline("Y-coordinate:
41
corner of the picture
42
+ Picture GetX());
+ Picture GetY());
43
44
45
46
47
Transcribed Image Text:are allowed 20 // Create an object of Picture by loading an image Picture pic = Picture("starry_night.png"); 21 22 23 // Display the width and height System.out.println("Width : System.out.println("Height: 24 25 + pic.getWidth()); + pic.getHeight()); 26 27 // Increase the width by 50 on both sides and // increase the height by 40 on both sides. // Must use dw and dh when calling method grow(). int dw, dh = 40; pic.grow(dw, dh); 28 29 30 31 32 33 // Display the width and height System.out.println("Width : System.out.println("Height: 34 + pic.getWidth()); + pic.getHeight()); 35 36 37 //Draw the picture draw(); 38 39 40 // Display the x and y coordinates of the top-left // System.out.printilne("X-coordinate: " System.out.printline("Y-coordinate: 41 corner of the picture 42 + Picture GetX()); + Picture GetY()); 43 44 45 46 47
9 public class PictureViewer
10{
public static void main(String[] args)
11
12
// Step 2: Fix the syntax errors and submit it
to Codecheck to pass the test.
// Note: Do not add or remove any statements
13
//
14
15
//
Do not change the semantics of each statement
Do not add or remove any variables
Do not add or remove any objects
Magic numbers are allowed
16
17
18
//
19
//
20
// Create an object of Picture by loading an image
Picture pic = Picture("starry_night.png");
21
22
23
// Display the width and height
System.out.println("Width : " + pic.getWidth());
System.out.println("Height:
24
25
+ pic.getHeight());
%3D
26
27
// Increase the width by 50 on both sides and
// increase the height by 40 on both sides.
// Must use dw and dh when calling method grow().
int dw, dh = 40;
pic.grow(dw, dh);
28
29
30
31
32
33
// Display the width and height
System.out.println("Width :
System.out.println("Height:
34
+ pic.getWidth());
+ pic.getHeight());
35
36
37
// Draw the picture
draw();
38
39
40
// Display the x and y coordinates of the top-left
41
Transcribed Image Text:9 public class PictureViewer 10{ public static void main(String[] args) 11 12 // Step 2: Fix the syntax errors and submit it to Codecheck to pass the test. // Note: Do not add or remove any statements 13 // 14 15 // Do not change the semantics of each statement Do not add or remove any variables Do not add or remove any objects Magic numbers are allowed 16 17 18 // 19 // 20 // Create an object of Picture by loading an image Picture pic = Picture("starry_night.png"); 21 22 23 // Display the width and height System.out.println("Width : " + pic.getWidth()); System.out.println("Height: 24 25 + pic.getHeight()); %3D 26 27 // Increase the width by 50 on both sides and // increase the height by 40 on both sides. // Must use dw and dh when calling method grow(). int dw, dh = 40; pic.grow(dw, dh); 28 29 30 31 32 33 // Display the width and height System.out.println("Width : System.out.println("Height: 34 + pic.getWidth()); + pic.getHeight()); 35 36 37 // Draw the picture draw(); 38 39 40 // Display the x and y coordinates of the top-left 41
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY