Assignment #7
Instructions
-
Write a Java program does the following:
-
Complete Exercise #2 and Exercise #3 from the slides.
-
Use try-catch blocks so that your program does not crash.
-
Here is an example program of using integers with the substring() method:
SubstringExample.java
-
Don't forget to include Java documentation (javadoc) comments in your program.
See the Java Coding Standard for details.
-
See the syllabus for the Assignment Grading Guidelines for your program assignments.
Example Input and Output
Example #1
Enter an integer: 3
Enter another integer: 5
3 modulus(%) 5 is: 3
Enter a sentence: Refrigerator!
Substring is: ri
Example #2
Enter an integer: three
ERROR: please enter an integer!
Example #3
Enter an integer: 5
Enter another integer: 3
5 modulus(%) 3 is: 2
Enter a sentence: Refrigerator!
ERROR: the integers are too big, negative, or the first is bigger than the second!
Example #4
Enter an integer: 3
Enter another integer: 0
ERROR: division by zero has no meaning!
Click to validate the HTML code
Click to validate the CSS code