|
Modular Division Programming Project
Imaginary Number Reducer
Objective: Change the class so that its method reducedForm() returns a String representing the simplified form of the imaginary number
| Input |
Input's Meaning |
Output |
| 3 |
i3 |
"-i" |
| 7 |
i7 |
"-i" |
| 2 |
i2 |
"-1" |
public class ImaginaryNumberReducer
{
int power;
public ImaginaryNumberReducer(int powerOfI)
{
//initialize variable
power = powerOfI;
}
//@returns "i" if is equivelenat to i^1
//@returns "-1" if is equivelenat to i^2
//@returns "-i" if is equivelenat to i^3
//@returns "1" if is equivelenat to i^4
public String reducedForm(){
return "change this!";
}
}
Top
|