American Young Coder (AYC)

AYC logo
Loading Events

« All Events

  • This event has passed.

6 PM – Advanced Python Game Development – Sebastian

May 13 @ 7:00 pm - 8:00 pm

Today We Did

  1. Learned about Java methods
  2. Learned about the difference between static and non-static methods by looking back at Python’s “self” parameter we had to put in all our methods inside a class.
  3. Learned how to generate a random number
  4. AYC Logic’s observed holidays: https://www.ayclogic.com/observed-holidays/
  5. In case you need anything, feel free to email me at sebastian@ayclogic.com
Homework
  1. Please submit your homework into your Google Drive
  2. Homework: Magic 8 ball, but this time in Java. I tried to re-explain it below, but here’s the original Python prompt in case that makes more sense to you (but either way, we’re doing this in Java!): https://www.ayclogic.com/intro-to-python/magic-8-ball/.

    1. First, create a list containing the following words:

      “yes”, “no”, “maybe”, “absolutely”, “I don’t think so”, “try again later”, “Cencentrate and ask again”, “My reply is no”

      Hint: You can copy/paste this directly into a method which turns this into a list, look back at your notes to find it.

    2. Next, ask for user input using Scanner
    3. Then create an infinite loop using while loops (same syntax as we’re used to, but remember to put parenthesis around true!) example:

      while (true) {
      }

    4. Inside our while loop, generate a random number and save it into a variable (make sure it has a good name).
    5. Ask the user to ask you a yes or no question
    6. Take in user input using scanner and store inside a string (make sure it has a good name).
    7. If the user says “stop”, break out of the while loop using the same keyword as in Python (just “break”).
    8. Otherwise, use the random number we previously generated to print out a random element from our list
  3. If everything is working correctly, your program should act like this: You first make a list with all possible responses, then ask the user to ask you questions, allowing the user to stop if they say “stop”, otherwise you print out a random response from the list we made.

Details

Date:
May 13
Time:
7:00 pm - 8:00 pm
Event Categories:
,
Verified by MonsterInsights