Answered step by step
Verified Expert Solution
Question
1 Approved Answer
in Java Write an application that instantiates an array of inf of user sine (at leas 2) and lets the user fill it with either
in Java
Write an application that instantiates an array of inf of user sine (at leas 2) and lets the user fill it with either mandoen values over the range [1. 2+size] or user entry. It should perform the methods lested below, in the given order. It should call the display method at the beginning and after every method call, 26 and eutputs the resulss of slops 7-9. You may use the global private statie Int al ze to kesp track of logeical sine. Required method5. You may define ocher helper methods as requirod. I. 14 displays the array neatly. It should also outpet the cument logical and physical sizes. precoedition: array is not null. % pablic static void display(int[] amray) 2. Hreplaces all instanees of target with new Value and returns number of replacements made main method should display the target, the new value and the namber of replacements made preconditionc array is not null"/ public static ist replace(intf] array, int target, int new Value) 3. Kappends new Value to the end of the array. If array is full, the method returns false and no changes are limade, otherwise tue should be returaed. Miprecondition: array is net null. public static boolean append(int[] array, int new Valoe) 4. Uresints amay to twice current physical size liprecondition: array is net null pablic satic ine[] resize(in[] array) Run the append method 43 again Happends new Value to the end of the array. If amay is full. the method returns false and no changes are made, /otherwise teoe should be returned. Hiprecondition: array is net eull public static boolean append(int] anray, int new Value) 5. Hinserts new Value to the specified index (pos) of the array. If array is fall, the method returns false and no lichanges are made, otherwise trae should be returned. liprecondition: array is net nall public static boolean insert(iat[] array, int new Value, int pos) 6. Adeletes all instances of tafyet from array. Shoald rearrange array to be "tight". Returns true if successful, false lif tagget is not found. Ifrecondition: array is not null public static boolean delete(int] anray, int target) 7. lireturn the index of the first occurrence of target, 1 if turpet is not in array public static int search(int[] arnay, int target) 8. I returns the index of the first occurrence of the minimumu value in array. public static int minlndex(int|] array) 9. Lreturns the maximum value in arrey. public static int max(int[] array) 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