C:\Documents And Settings\Lab11 19\Mis Documentos\MóDulo De Pruebas De Pista
Lab11 - Albanywooseok/201Fall/slide/Lab11.pdfMicrosoft PowerPoint - Lab11 Author Kim Created Date...
Transcript of Lab11 - Albanywooseok/201Fall/slide/Lab11.pdfMicrosoft PowerPoint - Lab11 Author Kim Created Date...
-
Lab11Wooseok Kim
www.cs.albany.edu/~wooseok/201
-
Main method
• Define a constant ARRAY_SIZE (i.e. size of the array)
-
Main method
• Create an array, called numbers, of integers of size ARRAY_SIZE
ARRAY_SIZE
ARRAY_SIZE[0] ARRAY_SIZE[1] ARRAY_SIZE[2]
-
Main method
• Pass the array to the getValues method
-
Main method
• Print “Here are the numbers that you entered”• Pass the array to the showArray method
-
getValue Method
• Accept a reference to an array as an argument
• Static method: https://introcs.cs.princeton.edu/java/21function/
-
getValue Method
• Create a Scanner object for keyboard input
-
getValue Method
• Print “Enter the numbers: “• Using for loop, read values into the array(Use .length)
-
showArray Method
• Accept an array as an argument
-
showArray Method
• Using for loop, display the array elements
-
1
-
2
-
3
-
4
-
5
-
6
-
7
-
9