Question: Write a Java program that obtains products' numbers (array named productsl), and allows the user to perform array's operations using the following methods: initializeArray()

Write a Java program that obtains products' numbers (array named productsl), and allows the user to perform array's operations using the following methods: initializeArray() - to initialize the array's elements printArray()- to print array's elements searchArray()- to search and determine if a product exists in the array removeArray()- to remove an array element and display the new array The program also includes: 1. One class named ArrayOperations 2. One instance variable named size Your program should include the following code statements in the ArrayApp class: Ariyoyerstions jeva "Araylop jave import javax. swing. J0ptionPane, 3 public class ArrayApp ( public static void main(String(1 args) { Arryoperations obj- new Arryoperations(); obj.initializeArray(); obj.printrray(); int searcho- Integer 19 porseint(30ptionPane.showImputDialog("Do you want to search for a product? 1- Yes, 2- No")); if (searcho e 1) obj. searcharray(); 12 h4 is int Ramoveo - Integer porseint(30ptionPane. showInputoialog("Do you want to remove a product fron the list? 1- Yes, 2- No")); 1f (Renoveg = 1) { obj.renovearray(); hs A sample run is shown below. Proulers Javadoc Declaration O Console Problens Javaduc Declo alion DCursole Amayhpp (1) (lava Appleation Carhpl.papontplugi Amyen ( ava Applicaton ClesholnzipoeighugrayApp (1 ve Applikaliun CNrstipkpzpuuhe EProblene vadue G Declwation Console Irout Inpul Inoie ? Enter product 1 number? 2102 ? How many products you store includes Enter product o number? f1920 OK Cancel OK Cancel OK Cancel Problems "Javadoc S Declaration B Conecie Problems Javadoe B Dechretion ecoreole AeroslamelvadacDedaratos concole e er: 1120 Peoduct Product 1 nuben 2ez Product 2 urber 30s Product nurber 201 Inpun Input Enter product 2 number? ? Enter product 3 mumber? 9201 3109 ? Da ya wa te saarah rora pr Y 1. Yes, a. OK Cancel On Can Cancel Robera lovodos Dlanelior OConsule oees Iadir ateon Conle AnayAnp 1 lava Applanon C pnpoohol ArayAnp e) fava Applration Ceshepoalphu iykop la utCinaiteoolglagisagockpjujupen Products Lst. Product e number: 1120 Product i numbee: 2102 Product 2 number 31e9 Product 3 nunber: 920 Products ise product e number: 1120 Product 1 nunber: 2102 reduct 2 number: jzeg Product 1 nunber: 9201 Products List: Product nunber: 10 Preduct 1 ninteri 2102 Praduct z nunter 11e Product nunber: 1201 Input Mecsage which prodact you want to display Do yos want to namove a product trom the tat? 1-Yen, 2-No The product is avalable in posiion no. 2 2102 OK Cancel OK LOK Ceneet Elskad d Problemsmnidor Beciation uConcole EProbleme lavadoc Declantion console ebeinialeda Aayop ( Seve Applcalioni CUvas Products List: Prodact 6wunber: 11 Prouct 3 nber 2 Product ster: Protuct ) sunber: 2 Products List: Product number: 2126 Produtt 1 nubae 2z Prodoct 2 nunber 3aes Product 3 numper 9201 Product e number: 1128 Product i nunber: 2202 Product 2 nunber: 31e9 Product 3 number: 9201 Updated Products List Mussa : 2 elch prodict yee Ment ta rerovet anterthe incss mnser Product e nunber: 1128 Product 1 nunber: 2182 Product 2 nunber: 9201 Product 3 nunber: e The prodact is ramoved am the OK Cance OK Provide screen shots of your answer and program code.
Step by Step Solution
3.51 Rating (158 Votes )
There are 3 Steps involved in it
The required code is given below The code for ArrayOperations class import javaxswingJOptionPane public class ArrayOperations int products int size Initialization public void initializeArray sizeInteg... View full answer
Get step-by-step solutions from verified subject matter experts
