Uploaded by اسامه المقطري

Assignment Five CIS 104

advertisement
AlYamamah University
College of Engineering and Architecture
Software Engineering Department
CIS 104: Programming fundamentals II
Assignment 5
Name: Mishal Alawwad
Student ID: 20191102
1/ (InputMismatchException) Write a program that prompt the user to read two
integers and displays their Multiply. Your program should prompt the user to
read the number again if the input is incorrect.(do while loop)
Input:
Output:
2/ (ArrayIndexOutofBoundException) write a program that meets the following
requirements:
 Create an array with 50 randomly chosen integers
 Prompt the user to enter the index of the array, then display the
corresponding element value. If the specified index is out of bounds,
display the message “out of bound”. Your program should prompt the
user read an index again if the input is incorrect (do while loop)
Output:
Using for-each loop:
Output:
Using Try-Catch :
Output:
Download