Answered step by step
Verified Expert Solution
Question
1 Approved Answer
How do I figure out the public Block(int y, int x, int size) // this contructor creates a 2D placeholder of null value; //these values
How do I figure out the
public Block(int y, int x, int size) // this contructor creates a 2D placeholder of null value; //these values will be populated later with calls to setTile() public Block(int y, int x, int size, byte color) // overloaded constuctor that creates a 2D matrix with actual tile objects; /o need to call setTile afterwards public Block scaleUp() // scales up the block (double size)
public class DynamicArray { } private T[] data; private int size; @SuppressWarnings ("unchecked") public DynamicArray(int size) { } public void set(int index, T obj){ if (index < 0 || index >= data.length) { } data = (T [])new Object[size]; this.size = 0; } } } throw new IndexOutOfBounds Exception (s: "Index out of bounds"); public T get(int index) { data[index] = obj; size++; if (index < 0 || index >= data.length) { throw new IndexOutOfBoundsException (s: "Index out of bounds"); } return data[index]; public int size(){ return size;
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