Question
Write a class pixel in java with following properties. please help . i have this task due tomorrow,I would rate positively. Thanks. As there is
Write a class pixel in java with following properties. please help . i have this task due tomorrow,I would rate positively. Thanks. As there is no description on how to calculate pixel bottom left , need help on that .
A Pixel has x, y coordinates, which are both integer values. A Pixel also has the following behaviors:
- It can return the value of its x and y coordinates. Use the follwoing method signatures to implement these behaviors. public int getX( ) public int getY( )
- It can change the value of its x and y coordinates. Use the following method signatures to implement these behaviours. public void setX(int xCoord ) public void setY(int yCoord )
- It can also return the x, y coordinates in a format exactly like (x,y). Use the method signature: public String toString( )
- The Pixel also has a construcor that initilizes the values of x, y coordinates to their default values.
- It also has a second constructor that initializes the coordinates to given values. Use the signature: public Pixel (int x, int y)
In java:
Define a class named Cell which has the following behaviors:
- It can return the pixel that represents the Cell, which is the bottom left corner of the cell. Use the method signature:
- public Pixel getBottomLeft( )
- It can change the pixel that represents the Cell. Use the method signature:
- public void setBottomLeft( Pixel pi)
- It can return the center (pixel) of the Cell. Use the method signature:
- public Pixel getCenter( )
- It can return the corners (pixel) of the Cell. Use the method signatures:
- public Pixel getTopLeft( )
- public Pixel getTopRight( )
- public Pixel getBottomRight( )
The Cell has the following two construcors that initilizes the value of pixel of its bottom-left corner.
- Default Constructor that initializes the x,ycoordintes of the pixel to zero.
public Cell( )
- A Constructor that accepted the pixel value and initializes the left-bottom corner pixel. public Cell(Pixel pix )
In java Define a class named Frame which has the following behaviors:
- It can return the pixel that represents the Frame. Use the method signature:
- public Pixel getBottomLeft( )
- It can change the pixel that represents the Frame. Use the method signature:
- public void setBottomLeft( Pixel pi)
- It can return the center (pixel) of the Frame. Use the method signature:
- public Pixel getCenter( )
- It can return the corners (pixel) of the Frame. Use the method signatures:
- public Pixel getTopLeft( )
- public Pixel getTopRight( )
- public Pixel getBottomRight( )
- Give the row and colomn number of the cell, it returns the pixel of that specific cell. Assume the first cell is row 1, colomn 1 and the top right cell is row 10, col 10. If the row and col values are outside the boundary of the Frame , the method returns null. Use the method signature:
- public Cell getCell( int row, int colomn )
- The class also has a constructor that accepts a Pixel as an argument. Use the following method signature: public Frame(Pixel pixel)
- A default construction initializes the class with a Pixel value of 0, 0:
public Frame()
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