« All Events
6 PM – Intro To Java
December 2, 2021 @ 6:00 pm - 7:00 pm
Homework
- Create a java file Dec2MethodHomework.java
- Inside this file, create a method
- favoriteSport(String sport)
- if the name parameter is “Volleyball” (non-casesensitive) print to the shell “Volleyball is a my favorite sport “.
- otherwise print to the shell “<sport> is not my favorite sport”
- Create another method, this time method with return value:
- convertFromFahrenheitToCelcius(int fahrenheit)
- it has one parameter: fahrenheit
- the formula to convert from fahrenheit to celcius is
- 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 from public static void main(String[] args) method