« All Events
6 PM – Intro To Java – Gamas
February 21 @ 6:00 pm - 7:00 pm
Today We Did
- We went over Random
- We went over methods
Homework
- Create Feb21Magic8BallHW.java
- https://www.ayclogic.com/intro-to-python/magic-8-ball/
- Create Feb21ConvertFromFahrenheitToCelciusHW.java
- Create a new method convertFromFahrenheitToCelcius. It has one parameter int fahrenheit. Inside the method, it will convert fahrenheit parameter into celcius by using this formula (F − 32) × 5/9 = C . You have to return the result. This is very similar to what we did in the class with addFourNumbers method.
- Create a new method run() . Inside this method, create a while loop to continuously ask user “Enter the temperature in Fahrenheit (enter ‘exit’ to quit): “. And then call convertFromFahrenheitToCelcius and pass the user input as the parameter. Get the return value from the method and print “100 Fahrenheit is 36 celcius”.
- Example
Welcome to AYC Temperature Converter
Enter the temperature in Fahrenheit (enter 'exit' to quit): 100
100 Fahrenheit is 36 celcius.
Enter the temperature in Fahrenheit (enter 'exit' to quit): 32
32 Fahrenheit is 0 celcius.
Enter the temperature in Fahrenheit (enter 'exit' to quit): exit
Thank you for using AYC Temperature Converter.