Question
public class Recurrences { //Implements the basic laws of positive exponents over the integers. Note: for this implementation, anything to the 0- power is 1.
public class Recurrences {
//Implements the basic laws of positive exponents over the integers. Note: for this implementation, anything to the 0- power is 1.
For example: 0^0 = 1. But 0^1 = 0.
public static int power( int base, int exponent ) {
throw new UnsupportedOperationException();
}
//pmod stands for pseudo-mod. The real modulus function needs to deal with negative integers, but this one assumes positive integers only. The modulus operator, from our perspective, looks just like the % (remainder) operator in Java except that you're implementing it recursively, and you will use it to implement the gcd function, which is defined imme- diately after this one. For example: pmod(4, 2) = 0, but pmod(4, 3) = 1, etc. You should look up "modulus" and/or review the definition of the "%" operator in Java for clarification.
public static int pmod( int a, int modulus ) {
throw new UnsupportedOperationException();
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started