Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Question 1 Exponentsjava Java program that creates and implements the method niceExponen...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