这两种方法有什么区别?JAVA

coi*_*ird 1 java methods roman-numerals

我的教授为我提供了一系列方法来填写罗马数字程序(加法格式,所以4 = IIII,9 = VIIII等)

我无法理解这两种方法之间的区别:

   **
   * This method prints, to the standard output and in purely additive
   * notation, the Roman numeral corresponding to a natural number.
   * If the input value is 0, nothing is printed. This
   * method must call the method romanDigitChar(). 
   * @param val   ?
   */

    public void printRomanNumeral(int val)
    {

    }

   **
   * This method returns the Roman numeral digit corresponding
   * to an integer value. You must use a nested-if statement.
   * This method cannot perform any arithmetic operations. 
   * @param val  ?
   * @return     ?
   */

    public char romanDigitChar(int val)

    {

    }
Run Code Online (Sandbox Code Playgroud)

romanDigitChar应该逐位读取一个数字,并且一次只能返回一位数字吗?如果是这样,我不明白printRomanNumeral将如何调用它.

我研究过其他罗马数字程序,但我似乎找不到任何使用其他方法调用的方法,比如我可以将它与之比较.

任何建议表示赞赏!

Pet*_*rey 5

我假设romanDigitChar返回一个char,用于精确匹配的数字,例如1,5,10,50,100等.printRomanNumeral会重复调用此值作为数字将已知值转换为字符.我建议使用两个嵌套循环,一个用于具有递减值的特定字符的金额,一个用于提取每个值.内循环调用第二种方法.

我假设他/她期望ASCII字符,尽管罗马数字有特殊的Unicode字符.