Formative4 Naong Machine Problem
Formative4 Naong Machine Problem
CCS0023L
(Object Oriented Programming)
Machine Problem
8
How to implement exception and assertion
Student Name:
Joshua Miguel Naong
Section:
Tb21
Professor:
Sir Kirk Awat
I.
Create a Class FindArray that will try to iterate in the array displaying the content
in each index. The program should be able to catch an
ArrayIndexOutOfBoundsException, a NullPointerException and a
RunTimeException.
SOURCE CODE:
import java.util.InputMismatchException;
import java.util.Scanner;
public class Main3 {
PART II
if (number < 0) {
number = -number;
prefix = "negative";
}
do {
int n = number % 1000;
if (n != 0){
String s = toWord(n);
current = s + specialNames[place] + current;
}
place++;
number /= 1000;
} while (number > 0);