Below is the class file; I now need a DRIVER file to test this class! Anything i
ID: 440870 • Letter: B
Question
Below is the class file; I now need a DRIVER file to test this class! Anything is appreciated import java.util.Scanner ; public class Array { Scanner input = new Scanner(System.in); int size = 20; int count = 0; int [] array = new int[size]; public void storeArray() { int i=0 ; for(i=0;ipos;i--) array[i-1] = array[i] ; return del ; } public boolean isEmpty() { if(count == 0) return true; else return false; } public boolean isFull() { if(count == size) return true; else return false; } public void copyArray() { int [] newArray = new int[size]; for(int i=0; i < array.length; i++) { if(array[i] > max) { max = array[i]; } } } public void lowestElem() { int max = array[0]; for (int i=1;i < array.length; i++) { if(array[i] < max) { max = array[i]; } } } }Explanation / Answer
//part of your program does not make sense. import java.util.Scanner ; public class ArrayDriver { public static void main(String[] args) { Scanner input=new Scanner(System.in); Array test=new Array(); System.out.println("Array test created"); System.out.println("Array currently empty: "+test.isEmpty()); System.out.printlm("Array currently full: "+test.isFull()); test.storeArray(); System.out.println("Array currently empty: "+test.isEmpty()); System.out.println("Array currently full: "+test.isFull()); System.out.println("Lowest element value is: "); test.lowestElem(); test.copyArray(); System.out.println("Array currently empty: "+test.isEmpty()); System.out.println("Array currently full: "+test.isFull()); input.close(); } }
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.