- In this lab, edit/add/update the given code to complete all parts.
- Add a method square() to SimpleMethod.java that takes a single argument and prints the result of squaring its integer parameter.
- In SimpleMethod2.java, expand the square function to return the result of the square as type int
- In the main class use System.out and Scanner to request the integer argument you'll pass to the square method.
- Store the result from square in an integer variable in main and print the result.
- Modify SimpleMethod3's square methods to use Math.pow instead of simple multiplying the numbers yourself.
- Complete both the integer and the double square functions, this is called method overloading!
- Write a method called toRadians that converts degrees to radians without using the Java Math library's method (using Math.PI is OK).
- HINT: degrees = radians * 180 / PI
- Write a method called toDegrees that converts radians to degrees without using the Java Math library's method (using Math.PI is OK).
- HINT: radians = degrees * PI / 180
- In the main function, compare your method's results to the Math.toRadians and Math.toDegrees methods by printing to the console.
- Create a feature branch (i.e. Feature001)
- Commit your working code
- Push it to your Remote/origin branch (i.e. GitHub)
- Then issue a Pull request to the instructor branch
- Make sure to save the Pull request URL and submit it for the lab.