Question: import java.util.Scanner; public class Assignment7 { public static void main(String[] args) { int number, size; String choice; char command; Scanner keyboard = new Scanner(System.in); //
import java.util.Scanner; public class Assignment7 { public static void main(String[] args) { int number, size; String choice; char command; Scanner keyboard = new Scanner(System.in); // ask a user for a array size System.out.println("Please enter a size for the array. "); size = keyboard.nextInt(); // instantiate an object IntList myList = new IntList(size); // print the menu printMenu(); do { // ask a user to choose a command System.out.println(" Please enter a command or type ?"); choice = keyboard.next().toLowerCase(); command = choice.charAt(0); switch (command) { case 'a': // add a number System.out.println(" Please enter an integer to add."); number = keyboard.nextInt(); myList.addInt(number); break; case 'b': // display the array System.out.print(myList); break; case 'c': // compute and display the maximum System.out.println(" The maximum is: " + myList.findMax()); break; case 'd': // compute and display the minimum System.out.println(" The minimum is: " + myList.findMin()); break; case 'e': // remove first number System.out.println(" Please enter an integer to remove."); number = keyboard.nextInt(); myList.removeFirst(number); break; case 'f': // remove all numbers System.out.println(" Please enter an integer to remove."); number = keyboard.nextInt(); myList.removeAll(number); break; case 'g': // display the numbers greater than user input System.out.println("Enter an integer: "); number = keyboard.nextInt(); int[] temp = myList.countNumbers(number); System.out.print(" List of all integers greater than " + number + " are: " ); for (int i=0; i ![import java.util.Scanner; public class Assignment7 { public static void main(String[] args)](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f51054a71b4_53266f51054271dc.jpg)
Method public IntList (int size) private int indexof (int searchingNum) Description of the Method The constructor instantiates an array of integers using the given size This method returns the index where searchingNum is located. It returms -1 ifit is not found. It checks if the array has not reached its capacity, the num is added to the array at the smallest available index This is a helper method; it is private and it doubles the size of the arra It returns the largest integer stored in the array, f no element stored in the array, it returns zero It returns the smallest integer stored in the array, if no element stored in the array, it returns zero public void addInt (int num) private void doubleArrayCapacity ( public int findMax () public int findMin () Removes the first occurrence of num from the list and moves all elements one spot to the left. It will leave the array the same if num is not in the list to be removed Removes all the occurrence of num from the array and shifts all the elements to the left by one index this method returns an array of all the integers that are public void removeFirst (int num) public void removeAll (int num) public int[] countNumbers (int num) public String toString () ater than num Displays the array of integers. It prints 10 integers per line, in this format [6, 7, 8,91- see the sample output Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
