Could Someone please help me two simple examples of how to do the following ?
Keep in mind the test the Arraytest.class has to be separate from the Array Class.
(Below is my fail attempts )
Question1: ///What I need to happen isArrayFull() : returns whether the array holding the vale is full or not.
the array does get full when it reaches 5.
----------------------------------------------------------------------------
Class: Array.Java
public boolean isArrayFull() {
if (array.length < mMaxArray) {
/// Dont know how to call the array length to be checked
return false;
} else {
return true;
}
}
//// Question 2 /// getMostRecentAmount(): returns the amount of the most recent array ( so last bit of the array.). If there haven't been any information added to the array is to return 0.
public int getMostRecentAmount() {
// if(array.length > 0){ /// if the array length is greater then zero do this
// /// method to search the array last bit
// return ; /// returns the most recent part of the array
// }
// else {
// return 0;
// }
}
-----------------------------------------------------------------------------
/// Having Trouble calling the array from the other class to test it
Class: TestArray.java
Array array1;
Array array2;
Array1 = new array1("ArrayName1", 78732983, 73);
Array1.finish();
System.out.println(array1.toString());
array2 = new array2 ("002 ArrayName2", 43232, 432);
array2.makeBet("Steven", 5300, 4);
array2.makeBet("James", 5600, 27);
array2.makeBet("Steven", 7000, 44);
array2.makeBet("James", 7500, 134);
array2.makeBet("Steven", 8700, 231);
array2.finish();
System.out.println(array2.toString());
}
}