Skip to content

Commit

Permalink
business class styling
Browse files Browse the repository at this point in the history
  • Loading branch information
kabir-vats committed Jan 20, 2025
1 parent b457d70 commit 41c491c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pricing/dynamic/business.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
from typing import List
import pandas as pd
from pandas import DataFrame
from pricing.dynamic.customer import Customer


class Business:
def __init__(self, costs, customer):
def __init__(self, costs: List[float], customer: Customer) -> None:
self.costs = costs
self.net_profit = 0
self.prices = costs.copy()
self.tiers = len(costs)
self.customer = customer
self.transaction_history = DataFrame(columns=['prices', 'chosen_tier'])

def sell(self):
def sell(self) -> None:
tier = self.customer.choose_tier(self.costs, self.prices)
self.net_profit += self.prices[tier] - self.costs[tier]
new_transaction = pd.DataFrame([[self.prices, tier]],
Expand All @@ -20,6 +22,6 @@ def sell(self):
self.transaction_history],
ignore_index=True)

def sell_n(self, n):
def sell_n(self, n: int) -> None:
for _ in range(n):
self.sell()

0 comments on commit 41c491c

Please sign in to comment.