Skip to content

CrumblyC00kie/Java-Lab-004

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java-Lab-004

  • In this lab, edit/add/update the given code to complete all parts.

Part 1: SimpleMethod.java

  • Add a method square() to SimpleMethod.java that takes a single argument and prints the result of squaring its integer parameter.

Part 2: SimpleMethod2.java

  • 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.

Part 3: SimpleMethod3.java

  • 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!

Part 4: Radians.java

  • 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.

Part 5 - Submission

  • 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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%