Java 巴比伦数字表示法

Java 巴比伦数字表示法,java,multidimensional-array,Java,Multidimensional Array,我是java新手,在接下来的两周内将完成以下任务。任何关于如何开始的建议都将不胜感激: 编写一个Java类,其实例表示巴比伦数字。您的类应至少提供以下方法: 以巴比伦形式表示的数字作为输入的构造函数(如“34,45,2”或“1,23,4,59,55”等) 将当前巴比伦数字的值作为整数返回的方法 将巴比伦数字转换为字符串形式的方法 将两个巴比伦数字相加生成新巴比伦数字的方法 一种从当前巴比伦数字中减去经过的巴比伦数字以生成新巴比伦数字的方法 如果对类可以表示的数字的大小有限制,请说明这些限制是什么

我是java新手,在接下来的两周内将完成以下任务。任何关于如何开始的建议都将不胜感激:

编写一个Java类,其实例表示巴比伦数字。您的类应至少提供以下方法:

  • 以巴比伦形式表示的数字作为输入的构造函数(如
    “34,45,2”或
    “1,23,4,59,55”等)
  • 将当前巴比伦数字的值作为整数返回的方法
  • 将巴比伦数字转换为字符串形式的方法
  • 将两个巴比伦数字相加生成新巴比伦数字的方法
  • 一种从当前巴比伦数字中减去经过的巴比伦数字以生成新巴比伦数字的方法 如果对类可以表示的数字的大小有限制,请说明这些限制是什么


    在下面,您将找到一组可能对您有所帮助的方法:

    /**
     * A representation of a Babylonina number.
     * <p>
     * TODO some examples/explanations of what Babyloninan numbers
     */
    class Babylonian
    {
      /**
       * Constructs a Babylonina number from a string.
       */
      public Babylonian(String number)
      {
      }
    
      /**
       * Returns the value of this Babyloninan number as an {@code int}.
       *
       * @return the value of this Babylonian number (as an int)
       */
      public int getBabylonian()
      {
      }
    
      /**
       * Returns the value of this Babyloninan number as a {@code String}.
       *
       * @return the value of this Babylonian number (as a String)
       */
      public String toString()
      {
      }
    
      /**
       * Adds the Babylonian number {@code x} to this number.
       *
       * @param x the Babylonian number to add
       */
      public void add(Babylonian x)
      {
      }
    
      /**
       * Substracts the Babylonian number {@code x} to this number.
       *
       * @param x the Babylonian number to substract
       */
      public void subtract(Babylonian x)
      {
      }
    }
    
    /**
    *巴比伦数字的一种表示。
    *
    *TODO关于巴比伦数字的一些示例/解释
    */
    巴比伦语
    {
    /**
    *从字符串构造一个数字。
    */
    公共巴比伦语(字符串编号)
    {
    }
    /**
    *以{@code int}的形式返回此数字的值。
    *
    *@返回这个巴比伦数字的值(作为整数)
    */
    公共int getBabylonian()
    {
    }
    /**
    *以{@code String}的形式返回此数字的值。
    *
    *@返回这个巴比伦数字的值(作为字符串)
    */
    公共字符串toString()
    {
    }
    /**
    *将巴比伦数字{@code x}添加到此数字。
    *
    *@param x要添加的巴比伦数字
    */
    公共空间添加(巴比伦x)
    {
    }
    /**
    *将巴比伦数字{@code x}减去此数字。
    *
    *@param x要减去的巴比伦数字
    */
    公共空白减去(巴比伦x)
    {
    }
    }
    
    从这里开始: