« All Events
6 PM – Intro To Java
May 27, 2021 @ 6:00 pm - 7:00 pm
- We reviewed Tell Me Your Age Homework using methods.
- We reviewed how to use methods (functions) in Java.
- Homework:
- Create a java file May27_MethodHomework.java
- Inside this file, create a method
- saySomethingCool()
- it has one parameter: String name
- if the name parameter is “Gamas” print to the shell “Gamas works at AYCLOGIC”.
- otherwise print to the shell “<name> is unknown” where <name> is the name parameter.
- Create another method, this time method with return value:
- convertFromFahrenheighToCelcius()
- it has one parameter: fahrenheit
- the formula to convert from fahrenheit to celcius is
-
Celcius = (F - 32) * 5/9
- So what you have to do is subtract 32 from the parameter fahrenheit and then multiple with 5 and divide by 9.
- return the calculation.
- The method needs to return a double data type.
- Call each of the methods.