It is vitally important that your program never \"crash\" as a result of a menu
ID: 3740805 • Letter: I
Question
It is vitally important that your program never "crash" as a result of a menu selection, regardless of what the user have chosen to do. To clarify, if the user chooses to increase the length of a sequence and no sequences are currently in the database, your program must print an error message but it must not crash. Similarly, if a user has loaded a sequence with 0 values (i.e., an empty list) and then asks to decrease its length by 1, the program must print an error message but it must not crash.
Explanation / Answer
Solution:
Note: It is not mentioned that one needs to implement this, so I am providing what is the solution to this problem.
To implement the above-stated situations we need to use try and catch block to catch the errors and give output instead of just crashing
An example of try catch is given below (in JAVA):
if a user has loaded a sequence with 0 values ?then:
I hope this helps if you find any problem. Please comment below. Don't forget to give a thumbs up if you liked it. :)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.