Write a Java program that obtains products' numbers (array named products), 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 shouid include the following code statements in the ArrayApp class:

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
AnayAnp lava Appiation C npoonpl yAop oova Appiraion Cehehpoaluginundnma ole
Write a Java program that obtains products' numbers (array named productsI), 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:
Aryoperstions jevaa "Araylop java
import javax. sking. J0ptionPane,
3 public clas ArrayApp {
public static void main(String 1 args) {
Arryoperations obj - new Arryoperations();
obj.initializeArray();
obj.printárray();
int searcho - Integer
19
he
hi
porseInt(J0ptionPane.showInputDialog("Do you want to search for a product 1- Yes, 2- No")):
if (searchQ 1) {
obj. searcharray():
12
13
h4
bs
int Ramoveg - Integer
porseint(30ptionPane.showInputoialog("Do you want to remove a product from the list? 1- Yes, 2- No"));
1f (Renoveg 1) (
obj.renovearray();
A sample run is shown below,
Problems Javadoc Decieration D Corsole
Arayhpp (1) (laa Applration Cers hel paiponhiekug amyon ( va Applicanion Ceshopzpooiplug urayhp (1) eve Applicatiun Carsitipkpzaushe
Problens Jovaduc Declo alion OCursole
2Prablens vadue GDecltion Console
Input
Inpul
Inpie
? Enter product 1 number?
2102
? How many products you store includes
Enter product O number?
1120
OK Cancel
OK
Cancel
OK Cancel
Prepared by Ms. Dalal Bamufleh.
Page Il of 11
Aroblameiovadac Dedaratios concolo
AProbilems avadoc S Declaration Conecie
Arrayep (1 Jera Aeplketkon CUsersihy peipoohAnayee lea Appkatoni CWweppu Praducte Liet
Problems lavadoe a Dechretion Gconsole
uer 12e
Product 1 nber 220z
Proiuct z turber 310
Product 3 murber: 201
Inpu
Input
Enter product 2 number?
Int
3109
2 Enter product 3 mumber?
s201
Da yan wa to caaran rora prdT1 Yes, 2. o
Cancel
OK
On Cana
OK
Cancel
Prula Jaradue 6 Dedareet DCuol
AnayAnp n lava Applaton C npoonplAayAnp (1) fava Appiration Cuehheponhphaniykoe D kat Ci alpoolglagiagockpjuju per
Products List.
Product nunberi 112o
Product i number: 2182
Product 2 number: 3ie0
Product 3 number: 92
Hobera levoos laretion Osul
rohees adar aeon Consele
Products List:
Product e munber: 1120
Product 1 munber: 2102
Preduct 2 munberi e9
Products List:
Product e nunber: 112
Product 1 nunber: 2182
Product z nunber 11e
Product nunter 1201
Product 3 nunber: 9207
Inpul
Message
jat
which prodact you want to display
Do yoe want to ramove a product trom the lar? 1-Yen, 2-No
The product is avaiale n postion no. 2
OK Cancel
OK
OK Cencel
Transcribed Image Text:AnayAnp lava Appiation C npoonpl yAop oova Appiraion Cehehpoaluginundnma ole Write a Java program that obtains products' numbers (array named productsI), 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: Aryoperstions jevaa "Araylop java import javax. sking. J0ptionPane, 3 public clas ArrayApp { public static void main(String 1 args) { Arryoperations obj - new Arryoperations(); obj.initializeArray(); obj.printárray(); int searcho - Integer 19 he hi porseInt(J0ptionPane.showInputDialog("Do you want to search for a product 1- Yes, 2- No")): if (searchQ 1) { obj. searcharray(): 12 13 h4 bs int Ramoveg - Integer porseint(30ptionPane.showInputoialog("Do you want to remove a product from the list? 1- Yes, 2- No")); 1f (Renoveg 1) ( obj.renovearray(); A sample run is shown below, Problems Javadoc Decieration D Corsole Arayhpp (1) (laa Applration Cers hel paiponhiekug amyon ( va Applicanion Ceshopzpooiplug urayhp (1) eve Applicatiun Carsitipkpzaushe Problens Jovaduc Declo alion OCursole 2Prablens vadue GDecltion Console Input Inpul Inpie ? Enter product 1 number? 2102 ? How many products you store includes Enter product O number? 1120 OK Cancel OK Cancel OK Cancel Prepared by Ms. Dalal Bamufleh. Page Il of 11 Aroblameiovadac Dedaratios concolo AProbilems avadoc S Declaration Conecie Arrayep (1 Jera Aeplketkon CUsersihy peipoohAnayee lea Appkatoni CWweppu Praducte Liet Problems lavadoe a Dechretion Gconsole uer 12e Product 1 nber 220z Proiuct z turber 310 Product 3 murber: 201 Inpu Input Enter product 2 number? Int 3109 2 Enter product 3 mumber? s201 Da yan wa to caaran rora prdT1 Yes, 2. o Cancel OK On Cana OK Cancel Prula Jaradue 6 Dedareet DCuol AnayAnp n lava Applaton C npoonplAayAnp (1) fava Appiration Cuehheponhphaniykoe D kat Ci alpoolglagiagockpjuju per Products List. Product nunberi 112o Product i number: 2182 Product 2 number: 3ie0 Product 3 number: 92 Hobera levoos laretion Osul rohees adar aeon Consele Products List: Product e munber: 1120 Product 1 munber: 2102 Preduct 2 munberi e9 Products List: Product e nunber: 112 Product 1 nunber: 2182 Product z nunber 11e Product nunter 1201 Product 3 nunber: 9207 Inpul Message jat which prodact you want to display Do yoe want to ramove a product trom the lar? 1-Yen, 2-No The product is avaiale n postion no. 2 OK Cancel OK OK Cencel
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY