American Young Coder (AYC)

AYC logo
Loading Events

« All Events

  • This event has passed.

6 PM – Python OOP – Gamas

November 30, 2022 @ 6:00 pm - 7:00 pm

Today We Did
  1. We went over Restaurant class homework
    1. We reviewed at Restaurant.set_number_served(sefl, num) method that will change Restaurant.number_served attribute.
    2. We reviewed at Restaurant.increment_number_served(self, num) method that will increase Restaurant.number_served attribute.
  2. We also went over how to use class inside ShoppingCart project.
  3. I uploaded all the files that we did in the class into google drive if you need to see: https://drive.google.com/drive/folders/1pqzz7Xd0Hf5MVGyQsoMqXdixRIqrZ5AH?usp=sharing
Homework
  1. If you did not finish last week’s homework, please finish it by next week.
  2. Inside Nov16_GrocceryShoppingCartUsingClass.py add the following features.
    1. Add one more attribute to GroceryItem class: frozen_food
    2. Add one more parameter in GrocerryItem.__init__ method: frozen_food
    3. Inside items_dictionary variable update the creation of GroceryItem so you would add one more parameter which is the frozen_food parameter. Use “yes” or “false”. For example, for “frozen pizza”, you would do GroceryItem(“frozen pizza”, 10, “yes”) because “frozen pizza” is a frozen food.
    4. Inside the while loop, add code that will check if gi.frozen_food is equal to “yes” then add the name to frozen_item list.
    5. When you do all above codes, then your program should not be able to list all frozen foods that you purchase like below
    6. What do you want to purchase:
      0. Frozen Pizza - $10
      1. Milk - $5
      2. Ice Cream - $4
      3. Bread - $6
      4. I am done, checkout please
      Enter your selection: 0
      You have purchased frozen pizza for $10
      
      What do you want to purchase:
      0. Frozen Pizza - $10
      1. Milk - $5
      2. Ice Cream - $4
      3. Bread - $6
      4. I am done, checkout please
      Enter your selection: 1
      You have purchased milk for $5
      
      What do you want to purchase:
      0. Frozen Pizza - $10
      1. Milk - $5
      2. Ice Cream - $4
      3. Bread - $6
      4. I am done, checkout please
      Enter your selection: 2
      You have purchased ice cream for $4
      
      What do you want to purchase:
      0. Frozen Pizza - $10
      1. Milk - $5
      2. Ice Cream - $4
      3. Bread - $6
      4. I am done, checkout please
      Enter your selection: 4
      
      You have purchased the following items: 
      FROZEN PIZZA
      MILK
      ICE CREAM
      
      Please pay $19, thank you for your business.
      
      Do not forget to put the following items in FREEZER
      FROZEN PIZZA
      ICE CREAM

Details

Date:
November 30, 2022
Time:
6:00 pm - 7:00 pm
Event Categories:
,
Verified by MonsterInsights