Question

In Java, if you wanted to get the pixel that is in the bottom-right hand corner...

In Java, if you wanted to get the pixel that is in the bottom-right hand corner of a picture object, how would you get it? Assume the picture object is called pic.

  

A) pic.getPixel(pic.getWidth() - 1, pic.getHeight() - 1);

   

B) pic.getPixel(0, 0);

   

C) pic.getPixel(bottom, right);

   

D) pic.getPixel(pic.getWidth(), pic.getHeight());

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Assume picture object as pic.

The origin (0,0) is located at the top left corner of the picture and 0 represents the x axis coordinate value and another 0 represents the y axis coordinate value. The coordinate system contains the range from (0,0) to (width -1, height - 1).

  • The value of width -1 represents the x axis co-ordinate of the bottom right hand corner of picture and width value is accessed through the getWidth() function.
  • To get the x axis coordinate value of the bottom right hand corner of the picture through pic object is pic.getWidth()-1.
  • The value of height -1 represents the y axis co-ordinate of the bottom right hand corner of picture and height value is accessed through the getHeight() function.
  • To get the y axis coordinate value of the bottom right hand corner of the picture through pic object is pic.getWidth() -1

To get the pixel that is in the bottom-right hand corner of a picture object is

pic.getPixel(pic.getWidth()- 1,pic.getHeight() – 1)

Thus , the correct option is (A).

Add a comment
Know the answer?
Add Answer to:
In Java, if you wanted to get the pixel that is in the bottom-right hand corner...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Solve for A: You can resize a matrix (when appropriate) by clicking and dragging the bottom right corner of the matrix...

    Solve for A: You can resize a matrix (when appropriate) by clicking and dragging the bottom right corner of the matrix -4-6-3 2 2 -6 -3 A1--1 6 -8 7 -7 -10 8 2 3 -5-4 000 A-0 0 0 O O 0 Solve for A: You can resize a matrix (when appropriate) by clicking and dragging the bottom right corner of the matrix -4-6-3 2 2 -6 -3 A1--1 6 -8 7 -7 -10 8 2 3 -5-4 000...

  • A square of side 0.5 m has a charge at each corner. The upper right hand...

    A square of side 0.5 m has a charge at each corner. The upper right hand corner is occupied by a -3 uC charge. Each remaining corner has a 3.0 uC charge. Find the electric field at the center of the square. Select one: O a. 2.2 x 10 N/C, northeast O b. 4.3 x 10 N/C, northeast O c. 6.1 x 10" N/C, southwest O d. 9.3 x 10" N/C, southwest What is the force a -1.0 uC charge...

  • As you can see here on the bottom right of this question; it asks: Shares sold...

    As you can see here on the bottom right of this question; it asks: Shares sold at $10 per share On the right side where it says Treasury stock; shouldn't the the entries look like this instead:   Dr. Cash 10 Cr. Treasury stock 10 Why is share repurchases debited by 2 and Retained Earnings debited by 1. American Semiconductor's balance sheet included the following: Shareholders' Equity ($ in millions) Common stock, 100 million shares at $1 par $ 100 Paid-in...

  • a) If you dive to the bottom of a deep pool, your eardrums may get uncomfortable...

    a) If you dive to the bottom of a deep pool, your eardrums may get uncomfortable or even start to hurt. On the other hand, if you take an airplane flight, you may find your eardrums getting uncomfortable in a different way. Both experiences arise from pressure changes, but how do they differ? Explain in your own words. b) Calculate the change in pressure your eardrums undergo when you dive to the bottom of a 4.85-m- deep swimming pool filled...

  • Java FX Application Purpose The purpose of this assignment is to get you familiar with the...

    Java FX Application Purpose The purpose of this assignment is to get you familiar with the basics of the JavaFX GUI interface components. This assignment will cover Labels, Fonts, Basic Images, and Layouts. You will use a StackPane and a BorderPane to construct the layout to the right. In addition you will use the Random class to randomly load an image when the application loads Introduction The application sets the root layout to a BorderPane. The BorderPane can be divided...

  • the wheel. The top part of the wheel is moving away from you and the bottom...

    the wheel. The top part of the wheel is moving away from you and the bottom is moving toward you a 2 You are walking holding on to the axle of a spinmin bicycle wheel with one hand on either side of 7) start to turn left, you feel the right side of the axde and the axle is horizontal. As you A) Pull on your right hand away from you B) push on your right hand toward the left....

  • Assignment Λ You shall write a Java program that accepts 5 command-line arguments and generates an image of a Sierpinski triangle, as a 24- bit RGB PNG image file. Specifications The command-line arg...

    Assignment Λ You shall write a Java program that accepts 5 command-line arguments and generates an image of a Sierpinski triangle, as a 24- bit RGB PNG image file. Specifications The command-line arguments shall consist of the following 1. The width (in pixels) of the image, as a positive decimal integer 2. The height (in pixels) of the image, as a positive decimal integer 3. The minimum area (in pixels) that a triangle must have in order to be drawn,...

  • Question 1 You are waving your hand frantically to get the attention of your friend across...

    Question 1 You are waving your hand frantically to get the attention of your friend across the street. Finally, they see you and head your way. You think “Thanks ________ system for getting my hand to get the attention of my friend.” a. parasympathetic b. sympathetic c. somatic d. afferent Question 2 Imagine that the parts of the brain can speak. As you look at a black widow spider coming towards you, which part would say, “I am your internal...

  • WRITE A C++ PROGRAM TO ANSWER THE QUESTIONS BELOW. You are provided with an image in...

    WRITE A C++ PROGRAM TO ANSWER THE QUESTIONS BELOW. You are provided with an image in a new file format called JBC Here is an example of the format: 2 3 100 50 40 200 66 56 12 45 65 23 67 210 0 255 100 45 32 123 The first line means that this is a 2 (width) by 3 (height) image of pixels. Then, each line represents the color of a pixel. The numbers are from 0 to...

  • A fly lands on one wall of a room. The lower-left corner of the wall is...

    A fly lands on one wall of a room. The lower-left corner of the wall is selected as the origin of a two-dimensional Cartesian coordinate system. The fly is located at the point having coordinates (1.90, 0.80) m. (a) How far is it from the origin (in m)? m (b) What is its location in polar coordinates? (Enter r in meters and θ in degrees.) r= m θ= ° counterclockwise from the +x-axis (c) What If? If the wall is...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT