Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void actionPerformed(ActionEvent e) {
- try { inputtext = gui.input.getText().toUpperCase(); }
- catch (IllegalArgumentException x) {
- gui.output.setText("Please enter either a Roman Numeral or a Number");
- }
- for (int i = 0; i < inputtext.length(); i++) {
- if (constants.contains(inputtext.charAt(i))) {
- charinput = inputtext.toCharArray();
- } else { gui.output.setText("Please enter a Roman Numeral");}
- }
- for (int i = 0; i < charinput.length; i++) {
- /*
- // Order:
- // 1) checks to see if previous is a roman numeral
- // 2) checks to see if previous is a higher number
- // 3) minuses from total based on previous
- // 4) adds to toal based on current place in loop
- */
- if (constants.contains(previous)) {
- System.out.println(charinput.length);
- for (int x = 0; x < charinput.length; x ++) {
- System.out.println(charinput[x]);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement