Question: QUESTION 1 Submit a class called Exponents.java, which contains the main () subroutine as usual, but also contains a subroutine called niceExponent (). This

QUESTION 1 Submit a class called Exponents.java, which contains the main () subroutine as usual, but also contains a subroutine called niceExponent (). This subroutine will calculate b", where b is a real number and n is a nonnegative integer. [1p] The niceExponent () subroutine should take as input a double (the base) and an int (the exponent). [2p] The niceExponent() subroutine should return a double (which is equal to the base raised to the exponent power). Your subroutine must NOT call the built-in Java subroutine Math.pow (). [2p] Call your subroutine from inside the main () method and use it to calculate (1.512)6. HINT: A number raised to a positive power can be calculated using a for loop: (2.7)4 = (2.7)(2.7)(2.7)(2.7) Extra Credit (2p): Modify your subroutine so it also works when the exponent is a negative integer. Attach File Browse Local Files Browse Content Collection
Step by Step Solution
3.37 Rating (163 Votes )
There are 3 Steps involved in it
Question 1 Exponentsjava Java program that creates and implements the method niceExponen... View full answer
Get step-by-step solutions from verified subject matter experts
