Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need help changing this from java to javascript please can you please comment

ID: 645433 • Letter: I

Question

I need help changing this from java to javascript please can you please comment so i know what is going on

public class RomanNumerals1 {
  
   static String [] getStrokes(int orderOfMagnitude) {
       String [] array = new String[3];
       switch (orderOfMagnitude) {
       case 1:
           String [] array1 = {"I","V","X"};
           array = array1;
           break;
       case 10:
           String [] array10 = {"X","L","C"};
           array = array10;
           break;
       case 100:
           String [] array100 = {"C","D","M"};
           array = array100;
           break;
       case 1000:
           String [] array1000 = {"M","?","?"};
           array = array1000;
           break;
       }
       return array;
   }

   static String convertDigit(int remainder, int divisor) {
       String [] numerals = getStrokes(divisor);
       String low = numerals[0];
       String mid = numerals[1];
       String high = numerals[2];
       String value = "";
       switch (remainder) {
       case 0: break;
       case 1:
       case 2:
       case 3:
               for (int i=0; i                    value += low;
               }
               break;
       case 4:
               value = low + mid;
               break;
       case 5:
               value = mid;
               break;
       case 6:
       case 7:
       case 8:
               value = mid;
               for (int i=0; i<(remainder-5); i++) {
                   value+= low;
               }
               break;
       case 9:
               value = low + high;
               break;
       case 10:
               value = high;
               break;
       }
       return value;
   }
  
   static String convertNumber(int n) {
       //System.out.printf("Number %d: ", n);
   int divisor = 1000;
   String value = "";
   while (n > 0) {
   int quotient = n / divisor;
   value += convertDigit(quotient, divisor);
   n = n - quotient * divisor;
   divisor = divisor / 10;
   }
   return value;
   }

   public static void main(String [] args) {
       System.out.printf("%d: %s ", 3854, convertNumber(3854));
       System.out.printf("%d: %s ", 2, convertNumber( 2));
   }

}

Explanation / Answer

You can convert java api into java script using GWT, or QWT.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote