#Object Oriented Programming (Python) #SIMPLE PROFIT CALCULATOR -- StudySourceCodes.blogspot.com class Sales: def __init__(self, prodName,costPrice,sellingPrice): self.prodName = prodName self.costPrice = costPrice self.sellingPrice = sellingPrice #Getting coat price def get_costPrice(self): return self.costPrice #Getting selling price def get_sellingPrice(self): return self.sellingPrice class Product: def __init__(self,prodCat,max_prods): self.prodCat = prodCat self.max_prods = max_prods self.products = [] #Adding products to a list def add_prods(self,product): if len(self.products) < self.max_prods: self.products.append(product) print("Product successfully added!\n\n") else: print("Oops! This product has reached maximum number of products!") #Calculating total profit def get_tot_profit(self): tot_profit = 0 for product in self.products: profit = product.get_sellingPri...
The program below does two things: 1. It allows a user to login if he or she already has an account on the system. 2. It allows a user to create an account and login afterwards if the user does not have an account already (New user) in the system. NOTE : The program allows the user only two chances in every action. If the user fails again in the second chance, the program denies access from the user. Try it to find out. It's fun... You can copy and paste in your development environment and study how the code works or type it out yourself. Either way, you are good to go. To login as an existing user use the details below: Username: studysourcecodes Password: python The program starts below: userDict = {"studysourcecodes":"python"} #Note: Username = Dictionary 'key' # Password = Dictionary 'value' result = "" result1 = "" result2 = "" result3 = "" result4 = ...