Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Test {
- public static void main(String[] args) {
- RootCalculator rootCalculator = new RootCalculator(2, 2);
- System.out.println(rootCalculator.findRoot());
- }
- }
- class RootCalculator {
- private int number;
- private int degree;
- RootCalculator(int number, int degree) {
- this.number = number;
- this.degree = degree;
- }
- public double findRoot() {
- return Math.pow(number, 1.0 / degree);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement