Assignment Array (Syafiqah Batrisyia)
Assignment Array (Syafiqah Batrisyia)
Page 1 of 9
INTRODUCTION
Page 2 of 9
PROBLEM STATEMENT
This program also allows user to retrieve the saved data. User will enter the keyword
(numBox) to be searched in the array.
The program then will display the following information:
- an appropriate message if the element is found
- the index of found element
- an appropriate message if the element is not found.
Page 3 of 9
PROBLEM ANALYSIS
Input : searchBox
Process : To determine whether the searchBox entered by user in the array based on the number
of boxes is found or not found. Repeat 10 times until the element of searchBox is found
and display the appropriate message and the index of the element. If the element of
searchBox is not found, display appropriate message.
Output : Message “Your order is found” and index of found element or message “Sorry, your
order is not found “.
Page 4 of 9
DESIGN A SOLUTION
Pseudocode
Start
numBox [ ] ={3, 2, 6, 4, 2, 1, 3, 1, 2, 4}
searchBox=0
i=0, found=false
while (i < 10)
if (searchBox = = numBox [i])
Print “Your order found in index: “
found = true
endif
i=i+1
endwhile
if (found = = false)
Print “Sorry, your order is not found.”
else
Print “Your order is found.”
endif
Stop
Page 5 of 9
Flowchart
Start
numBox []={3,2,6,4,2,1,3,1,2,4}
i=0
found = true
searchBox=0
F
searchBox
Print “Your
==numBox[i]
order is found”
found = true
i=i+1
Page 6 of 9
IMPLEMENTATION & DOCUMENTATION
Page 7 of 9
TESTING
Sample Output
a. Searching for Number of Box (Searching is not found)
Page 8 of 9
REFERENCES
Amran, M., & Marziah, M. Z. (2022). PROBLEM SOLVING USING JAVA LEARN BY EXAMPLE
(4th ed.).
Page 9 of 9