Imunirah / warmup-w04d04-classes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Shops!

Create a class Shop that can help shop owners keep track of their products!

Our class should have multiple functionality:

  • initialize your shop with a random ID.

  • add_product should take the name, price and stock of your product. Stock should be optional otherwise it counts as 1.

  • sale should print out new prices for all your products based on the percentage you pass
    sale(50) #applies a 50% sale

  • stock show the stock of your products

  • purchase should take the name and amount of the purchased item. Then subtracts the amount of items you purchase from your stock, if your stock is empty, it gives a warning.

  • show_products Displays all products information!

Bonuns

  • remove_product takes a product name and removes that product from your shop list

About