Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- import random
- class Job(object):
- def __init__(self,profession, salary, mortgage_payment, car_payment, cc_payment, child_expenses, money_available):
- self.profession = profession
- self.salary = salary
- self.tax_payment = self.salary // 5
- self.mortgage_payment = mortgage_payment
- self.car_payment = car_payment
- self.cc_payment = cc_payment
- self.child_expenses = child_expenses
- self.money_available = money_available
- self.income_status = True
- self.amt_invested = 0
- self.amt_invested_bo = 0
- def get_profession(self):
- return self.profession
- def get_salary(self):
- return self.salary
- def get_tax(self):
- return self.tax_payment
- def get_mortgage(self):
- return self.mortgage_payment
- def get_car_payment(self):
- return self.car_payment
- def get_cc_payment(self):
- return self.cc_payment
- def get_money_avail(self):
- return self.money_available
- def get_child_expenses(self):
- return self.child_expenses
- def income(self):
- return self.income_status
- Doc = Job('doctor', random.randint(12000,15000), random.randint(2500,3500), random.randint(200,500), random.randint(600,1000),random.randint(150,300), random.randint(4500,5500))
- Eng = Job('engineer', random.randint(3500,5000), random.randint(800,1300), random.randint(100,300), random.randint(200,400), random.randint(100,250), random.randint(2500,4000))
- Pol = Job('policeman', random.randint(3000,4000), random.randint(700,1200), random.randint(100,300), random.randint(200,400), random.randint(100,250), random.randint(2500,4000))
- Pro = Job('programmer', random.randint(3500,4500), random.randint(700,1200), random.randint(100,300), random.randint(200,400), random.randint(100,250), random.randint(3000,4000))
- Acc = Job('accountant', random.randint(4000,5000), random.randint(1000,1400), random.randint(100,300), random.randint(300,450), random.randint(130,280), random.randint(3500,4500))
- Rec = Job('receptionist', random.randint(2500,3500), random.randint(900,1200), random.randint(100,200), random.randint(200,350), random.randint(100,220), random.randint(2800,3500))
- Com = Job('commercial pilot', random.randint(7000,11000), random.randint(2000,2300), random.randint(150,300), random.randint(500,900), random.randint(130,300), random.randint(4000,5000))
- income = True
- Jobs = [Doc,Eng,Pol,Pro,Acc,Rec,Com]
- def validate_menu(user_input):
- if len(user_input) == 1 and user_input.isdigit() == True:
- if int(user_input) == 1 or int(user_input) == 2:
- return True
- else:
- return False
- def validate_menu2(user_input):
- if len(user_input) == 1 and user_input.isdigit() == True:
- if int(user_input) == 1 or int(user_input) == 2:
- return True
- else:
- return False
- def next_func(statement):
- reactor = input(statement)
- print("-" * 50)
- def next_line():
- print("-" * 50)
- def intro():
- print("Welcome to Dollars and Sense! (cents haha)")
- print("In this game, you will go on a wonderful adventure, simulating real life careers. \nYou will encounter many real life situations, where you should utilize your finances wisely.")
- print("The choices you make may affect the outcome!")
- print("To begin, press enter!")
- next_func("")
- def add_income(job):
- if occupation.income() == True:
- job.money_available += job.salary
- def employment_status():
- if occupation.income() == True:
- return "Employed"
- else:
- return "Unemployed"
- occupation = Jobs[random.randint(0,len(Jobs)-1)]
- def game():
- print("Welcome to the game for financial freedom! You have spawned as a " + occupation.get_profession() + "! Try to get enough passive income to cover all your expenses so you can triumph and succeed. Here you can view your financial statistics:")
- print("Salary: $" + str(occupation.get_salary()))
- print("Taxes payment: $" + str(occupation.get_tax()))
- print("Mortgage payment: $" + str(occupation.get_mortgage()))
- print("Car payment: $" + str(occupation.get_car_payment()))
- print("Credit card debt: $" + str(occupation.get_cc_payment()))
- print("Child expenses: $" + str(occupation.get_child_expenses()))
- print("Money left: $" + str(occupation.get_money_avail()))
- next_func("")
- def status():
- print("Salary: $" + str(occupation.get_salary()))
- print("Taxes payment: $" + str(occupation.get_tax()))
- print("Mortgage payment: $" + str(occupation.get_mortgage()))
- print("Car payment: $" + str(occupation.get_car_payment()))
- print("Credit card debt: $" + str(occupation.get_cc_payment()))
- print("Child expenses: $" + str(occupation.get_child_expenses()))
- print("Money left: $" + str(occupation.get_money_avail()))
- print("Employment status: " + employment_status())
- print("Press enter to continue...")
- next_func("")
- def acc_choice():
- print("1. Check status \n2. Next")
- inp = input("Please enter your option: ")
- done = False
- while not done:
- if validate_menu(inp):
- if int(inp) == 1:
- done = True
- status()
- elif int(inp) == 2:
- done = True
- pass
- else:
- print("Please key in a valid input!")
- inp = input("Please enter your option: ")
- def acc(number):
- if number == 1:
- print("Oh no! You've been retrenched!")
- print("You will receive no income until you find a new job.")
- occupation.income_status = False
- acc_choice()
- next_line()
- elif number == 2:
- print("Oh no! You were on your way home in your car and accidentally crashed into a stranger's car!")
- print("The stranger wants a compensation of $200")
- occupation.money_available -= 200
- acc_choice()
- next_line()
- elif number == 3:
- print("Your car has been sent for repairs for recent damages. You don't have a choice but to fork out $200.")
- occupation.money_available -= 200
- acc_choice()
- next_line()
- elif number == 4:
- print("Your mother has been admitted to the hospital")
- print("You paid $1000 for her hospital fees")
- occupation.money_available -= 1000
- acc_choice()
- next_line()
- def inv(number):
- if number == 1:
- print("Your friend is in need for some money for an investment. He will not be able to pay you back if it fails. Are you willing to help?")
- print("1. Yes")
- print("2. No")
- print("3. Check status")
- inp = input("Please enter your choice: ")
- done = False
- if validate_menu(inp):
- if int(inp) == 1:
- inp = input("How much are you willing to lend him?")
- while not done:
- if inp.isdigit() == False:
- print("Please enter a numerical value!")
- inp = input("How much are you willing to lend him?")
- elif int(inp) <= 0:
- print("Please enter a positive number!")
- inp = input("How much are you willing to lend him?")
- elif int(inp) >= occupation.get_money_avail():
- print("Please enter an amount that you can afford!")
- inp = input("How much are you willing to lend him?")
- elif inp.isdigit() and int(inp) > 0:
- occupation.amt_invested += int(inp)
- occupation.money_available -= int(inp)
- done = True
- next_line()
- elif int(inp) == 2:
- done = True
- next_line()
- elif int(inp) == 3:
- status()
- else:
- print("Please enter a valid input")
- inp = input("Please enter your choice: ")
- elif number == 2:
- print("You need some quick cash and chanced upon this thing called 'binary options' online. ")
- print("You learn that it is able to gain insane profits from the numerous reviews.")
- print("Do you put money into it?")
- print("1. Yes")
- print("2. No")
- print("3. Check status")
- inp = input("Please enter your choice: ")
- done = False
- if validate_menu(inp):
- if int(inp) == 1:
- inp = input("How much are you willing to put in? $")
- while not done:
- if inp.isdigit() == False:
- print("Please enter a numerical value!")
- inp = input("How much are you willing to put in? $")
- elif int(inp) <= 0:
- print("Please enter a positive number!")
- inp = input("How much are you willing to put in? $")
- elif int(inp) >= occupation.get_money_avail():
- print("Please enter an amount that you can afford!")
- inp = input("How much are you willing to put in? $")
- elif inp.isdigit() and int(inp) > 0:
- occupation.amt_invested_bo += int(inp)
- occupation.money_available -= int(inp)
- done = True
- next_line()
- elif int(inp) == 2:
- done = True
- next_line()
- elif int(inp) == 3:
- status()
- else:
- print("Please enter a valid input")
- inp = input("Please enter your choice: ")
- def choices(number):
- if number == 1:
- print("All of your friends have purchased the latest video game, Overwatch.\nThey have been convincing you to join them in the game.")
- print("Do you purchase Overwatch?")
- print("1. Yes")
- print("2. No")
- print("3. Check status")
- done = False
- while not done:
- inp = input("Please enter your option: ")
- if validate_menu2(inp):
- if int(inp) == 1:
- print("The game costs $60. $60 have been deducted from your available money.")
- done = True
- next_line()
- if int(inp) == 2:
- done = True
- next_line()
- if int(inp) == 3:
- status()
- else:
- print("Please enter a valid option!")
- if number == 2:
- print("All of your friends have purchased the latest video game, Overwatch.\nThey have been convincing you to join them in the game.")
- print("Do you purchase Overwatch?")
- print("1. Yes")
- print("2. No")
- print("3. Check status")
- done = False
- while not done:
- inp = input("Please enter your option: ")
- if validate_menu2(inp):
- if int(inp) == 1:
- print("The game costs $60. $60 have been deducted from your available money.")
- done = True
- next_line()
- if int(inp) == 2:
- done = True
- next_line()
- if int(inp) == 3:
- status()
- else:
- print("Please enter a valid option!")
- if number == 3:
- print("All of your friends have purchased the latest video game, Overwatch.\nThey have been convincing you to join them in the game.")
- print("Do you purchase Overwatch?")
- print("1. Yes")
- print("2. No")
- print("3. Check status")
- done = False
- while not done:
- inp = input("Please enter your option: ")
- if validate_menu2(inp):
- if int(inp) == 1:
- print("The game costs $60. $60 have been deducted from your available money.")
- done = True
- next_line()
- if int(inp) == 2:
- done = True
- next_line()
- if int(inp) == 3:
- status()
- else:
- print("Please enter a valid option!")
- if number == 4:
- print("All of your friends have purchased the latest video game, Overwatch.\nThey have been convincing you to join them in the game.")
- print("Do you purchase Overwatch?")
- print("1. Yes")
- print("2. No")
- print("3. Check status")
- done = False
- while not done:
- inp = input("Please enter your option: ")
- if validate_menu2(inp):
- if int(inp) == 1:
- print("The game costs $60. $60 have been deducted from your available money.")
- done = True
- next_line()
- if int(inp) == 2:
- done = True
- next_line()
- if int(inp) == 3:
- status()
- else:
- print("Please enter a valid option!")
- if number == 5:
- print("All of your friends have purchased the latest video game, Overwatch.\nThey have been convincing you to join them in the game.")
- print("Do you purchase Overwatch?")
- print("1. Yes")
- print("2. No")
- print("3. Check status")
- done = False
- while not done:
- inp = input("Please enter your option: ")
- if validate_menu2(inp):
- if int(inp) == 1:
- print("The game costs $60. $60 have been deducted from your available money.")
- done = True
- next_line()
- if int(inp) == 2:
- done = True
- next_line()
- if int(inp) == 3:
- status()
- else:
- print("Please enter a valid option!")
- if number == 6:
- print("All of your friends have purchased the latest video game, Overwatch.\nThey have been convincing you to join them in the game.")
- print("Do you purchase Overwatch?")
- print("1. Yes")
- print("2. No")
- print("3. Check status")
- done = False
- while not done:
- inp = input("Please enter your option: ")
- if validate_menu2(inp):
- if int(inp) == 1:
- print("The game costs $60. $60 have been deducted from your available money.")
- done = True
- next_line()
- if int(inp) == 2:
- done = True
- next_line()
- if int(inp) == 3:
- status()
- else:
- print("Please enter a valid option!")
- def main():
- counter = 1
- done_all = True
- while done_all:
- print("Day " + str(counter))
- randomnumber = random.randint(0,100)
- done = False
- while occupation.money_available >= 0 and done == False:
- if randomnumber in range (0,10):
- randomint = random.randint(0,4)
- acc(randomint)
- randomnumber = random.randint(0,100)
- elif randomnumber in range(11,30):
- randomint = random.randint(0,2)
- inv(randomint)
- counter += 1
- if counter % 5 == 0:
- if occupation.income() == True:
- occupation.money_available += occupation.get_salary()
- print("Your pay is here! You have been paid $" + str(occupation.get_salary()) + "!" )
- randomnumber = random.randint(0,100)
- else:
- print("You are lucky")
- randomnumber = random.randint(0,100)
- print("You have lost the game. Better luck next time!")
- done_all = False
- intro()
- game()
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement