« All Events
5 PM – Intro To Java – Alex Lee
March 10, 2023 @ 5:00 pm - 6:00 pm
Today We Did:
- We went over the Magic8Ball homework
- Also, learned about methods and how object-oriented programming works.
For Homework:
- Convert your Magic8Ball homework into a much shorter version of it:
- Put all of the different answer options into one list.
- Then by using a random number index, choose one of the options and print it out.
- The program should still ask “Enter yes or no question” and when the user inputs quit, the program should end.
- Create a new Java class <date>_MethodsHomework.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.
- Ask the user: “What temperature would you like to convert: ” and put the user’s input into the method.
- Print out “The temperature was converted from Fahrenheit: ‘fahrenheitNumber’ into Celsius: ‘celsiusNumber’