Question
Need some Java Help !! Some notes: We will only use images that are symmetric. That means that pixels[row,col] == pixels[col,row] will always be true
Need some Java Help !!
Some notes:
We will only use images that are symmetric. That means that pixels[row,col] == pixels[col,row] will always be true for any valid row and col index values. No matter which way you map x,y to row, col it will work.
Also, each image will have the same number of rows as columns (i.e., a square image).
- Write a class called MyImage that extends the Image class. Your class must be concrete. Complete the abstract methods based on the interface (method descriptions) given(Look at the Image file).
Please include comments and tests soi can understand what you are doing. Thank you in advance!
-Files provided :
- Image.java
public abstract class Image{ /* black pixels are true and white pixels are false */ protected boolean[][] pixels; protected int rows; protected int cols; public Image(int rows, int cols){ this.rows = rows; this.cols = cols; this.pixels = new boolean[rows][cols]; } public Image(boolean[][] data){ this(data.length, data[0].length); for(int r=0; r- Position.java
public class Position{ protected int x; protected int y; public Position(int x, int y){ this.x = x; this.y = y; } public int getX(){ return this.x; } public int getY(){ return this.y; } @Override public String toString(){ return "(" + this.x + "," + this.y + ")"; } }
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