Implement the following two static methods Note that,...

This preview shows page 1 - 3 out of 4 pages.

CSE 2221 HW 13 1. Implement the following two static methods. Note that, although the two methods compute the same function, the first one clears the given NaturalNumber while the second one restores it.
2. Implement the static method declared as follows:
* small enough. * * @param n * the given {@code NaturalNumber} * @return the value * @requires n <= Integer.MAX_VALUE * @ensures toInt = n */ private static int toInt(NaturalNumber n) { int num = 0; num = n.divideBy10(); while(!n.equals(0)) { num = n.divideBy10(); } return num; } 3.

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture