def main(): # Get the starting balance. start_bal = float(input('Enter your starting balance: ')) # Create a BankAccount object. savings = bankaccount.BankAccount(start_bal) # Deposit the user's paycheck. pay = float(input('How much were you paid this week? ')) print('I will deposit that into your account.') savings.deposit(pay) # Display the balance. print('Your account balance is $', \ format(savings.get_balance(), ',.2f'), sep='') # Get the amount to withdraw. cash = float(input('How much would you like to withdraw? ')) print('I will withdraw that from your account.') savings.withdraw(cash) # Display the balance. print('Your account balance is $', \ format(savings.get_balance(), ',.2f'), sep='')
def main(): # Получить начальный остаток. start_bal = float(input('Введите свой начальный остаток: ')) # Создать объект BankAccount. savings = bankaccount.BankAccount(start_bal) # Внести на счёт зарплату пользователя. pay = float(input('Сколько Вы получили на этой неделе? ')) print('Вношу эту сумму на Ваш счёт.') savings.deposit(pay) # Показать остаток. print('Ваш остаток на банковском счёте составляет ₽', format(savings.get_balance(), '.2f'), sep='') # Получить сумму для снятия с банковского счёта. cash = float(input('Какую сумму вы желаете снять со счёта? ')) print('Снимаю эту сумму с Вашего банковского счёта.') savings.withdraw(cash) # Показать остаток. print('Ваш остаток на банковском счёте составляет ₽', format(savings.get_balance(), '.2f'), sep='')
def main(): # get the starting balance start_bal = float(input("Enter your starting balance: ")) # create a BankAccount object savings = bankaccount.BankAccount(start_bal) # deposit the user's paycheck pay = float(input("How much were you paid this week?")) print("I will deposit that into your account.") savings.deposit(pay) # display the balance print("Your account balance is $", format(savings.get_balance(), ',.2f'), sep='') # get the amount to withdraw cash = float(input("How much would you like to withdraw?")) print("I will withdraw that from your account.") savings.withdraw(cash) # display the balance print("Your accout balance is $", format(savings.get_balance(), ',.2f'), sep='')
def main(): #lets get the starting balance starting_balance = float(input('What is your starting balance: ')) #lets create an object from the Bankaccount class savings = bankaccount.BankAccount(starting_balance) #now lets deposite payment = float(input('What is the ammunt of your payment: ')) print('Adding to your balance...') savings.deposit(payment) #Display the balance #print('Your balance is: ', savings.get_balance()) print(savings) #withdraw an amount from the balance withdraw = float(input('How much to withdraw: ')) print('Withdrawing some amount... ') savings.withdraw(withdraw) #Display the balance #print('Your net balance is now: ', savings.get_balance()) print(savings)
def main(): # Określenie salda początkowego. start_bal = float(input('Podaj początkową wysokość salda: ')) # Utworzenie obiektu BankAccount. savings = bankaccount.BankAccount(start_bal) # Zdeponowanie pewnej kwoty na koncie. pay = float(input('Jaką kwotę zarobiłeś w tym tygodniu? ')) print('Ta kwota została zdeponowana na koncie.') savings.deposit(pay) # Wyświetlenie salda bieżącego. print('Wysokość salda wynosi ', format(savings.get_balance(), '.2f'), sep='') # Pobranie kwoty, która ma zostać wypłacona. cash = float(input('Jaką kwotę chcesz wypłacić? ')) print('Ta kwota zostanie odjęta od bieżącej wysokości salda.') savings.withdraw(cash) # Wyświetlenie salda bieżącego. print('Wysokość salda wynosi ', format(savings.get_balance(), '.2f'), sep='')
def main(): # Get the starting account balance start_bal = float(input('Enter your starting balance: ')) # Create a BankAccount object savings = ba.BankAccount(start_bal) # using an alternate way to use __str__ function from a class message = str(savings) print(message) # Deposit the users paycheck # This won't account for negative values btw pay = float(input('How much were you paid this week? ')) print('I will deposit $', format(pay, ',.2f'), ' into your account') savings.deposit(pay) # Display the balance """print('Your account balance is $', format(savings.get_balance(), ',.2f'))""" print(savings) # Get the amount to withdraw cash = float(input('How much would you like to withdraw? ')) print('I will attempt to withdraw $', format(cash, ',.2f'), ' from your account') savings.withdraw(cash) # Display the balance """print('Your account balance is $', format(savings.get_balance(), ',.2f'))""" print(savings)
def main(): #get starting balan start_balance = float(input('Enter starting balance: ')) #create account savings = bankaccount.BankAccount(start_balance) #deposit check pay = float(input('How much were you paid this week? ')) print('I will deposit this into your account') savings.deposit(pay) #display balance print('Your account balance is $', format(savings.get_balance(), ',.2f'), sep='') #withdraw some cash cash = float(input('How much would you like to withdraw? ')) print('I will withdraw that from your account') savings.withdraw(cash) #display balance print('Your account balance is $', format(savings.get_balance(), ',.2f'), sep='') #test print function print(savings)
def main(): startingBalance = float(input("Enter starting balance: $")) savings = bankaccount.BankAccount(startingBalance) pay = float(input("How much did you just get? $")) savings.deposit(pay) # Because of the __str__ function you can get a default string returned print(savings)
def get_hourly_employee(): emp_id = input('Enter the employee ID: ') first = input('Enter first name of the employee: ') last = input('Enter last name of the employee: ') rate = float(input('Enter the employees hourly rate: ')) dues = float(input('Enter the employees weekly dues: ')) employee_data = employee.Employee(emp_id, first, last, rate, dues) print() print('Enter the employees address.') street = input('Street Address: ') city = input('City: ') state = input('State: ') zipcode = input('Zip: ') address_data = address.Address(street, city, state, zipcode) print() print('Please enter your time worked today.') date = input('Enter today\'s date (MM/DD/YY): ') start = float(input('Enter start time (AM): ')) end = float(input('Enter end time (PM): ')) time_data = timecard.TimeCard(date, start, end) hours = time_data.calculate_daily_pay( ) # setup for loop to calc 7 days week totals if hours > HOURS: overtime_pay = ((hours - HOURS) * OVERTIME * employee_data.get_hourly_rate()) regular_pay = (HOURS * employee_data.get_hourly_rate()) total_pay = overtime_pay + regular_pay else: total_pay = (HOURS * employee_data.get_hourly_rate()) deposit = total_pay - employee_data.get_weekly_dues() print() print('Enter your bank account information.') bank = input('Enter your bank name: ') routing = input('Enter the routing number: ') account = input('Enter the account number: ') bank_data = bankaccount.BankAccount(bank, routing, account) print() print(str(employee_data.get_full_name())) print(str(address_data.get_address())) print('Depositing $', format(deposit, ',.2f'), 'in', str(bank_data.get_bank_name()), 'Account Number:', \ str(bank_data.get_account_id()), 'using Routing Number:', \ str(bank_data.get_routing_number()), sep=' ') print()
def main(): name = input('Enter your name: ') start_bal = float(input('Enter your starting balance: ')) savings = bankaccount.BankAccount(name, start_bal) pay = float(input('Enter how much you just got paid: ')) print('I will deposit this for you into your Savings') savings.deposit(pay) print(savings) cash = float(input('How much would you like to withdraw? ')) print('I will withdraw this cash for you.') savings.withdraw(cash) print(savings)
def get_salary_employee(): emp_id = input('Enter the employee ID: ') first = input('Enter first name of the employee: ') last = input('Enter last name of the employee: ') salary = float(input('Enter the employees salary: ')) commission = float(input('Enter the employees commission rate(%): ')) dues = float(input('Enter the employees weekly dues: ')) employee_data = salariedemployee.SalariedEmployee(emp_id, first, last, salary, commission, dues) print('Enter the employees address.') street = input('Street Address: ') city = input('City: ') state = input('State: ') zipcode = input('Zip: ') address_data = address.Address(street, city, state, zipcode) print() print('Enter the employee\'s sales data.') date = input('Enter today\'s date (MM/DD/YY): ') sales = float(input('Please enter the employee\'s sales: ')) receipt_data = receipt.Receipt( date, sales) # setup for loop to calc sales receipts over month print() salary_pay = ( salary / YEAR_SALARY_HOURS ) * SALARY_HOURS # needs to be updated to account for 5 week months commission_pay = receipt_data.get_sales() * commission / COMMISSION_CONVERT deposit = salary_pay + commission_pay - employee_data.get_weekly_dues() print('Enter your bank account information.') bank = input('Enter your bank name: ') routing = input('Enter the routing number: ') account = input('Enter the account number: ') bank_data = bankaccount.BankAccount(bank, routing, account) print() print(str(employee_data.get_full_name())) print(str(address_data.get_address())) print('Depositing your monthly paycheck...') print('Depositing $', format(deposit, ',.2f'), 'in', str(bank_data.get_bank_name()), 'Account Number:', \ str(bank_data.get_account_id()), 'using Routing Number:', \ str(bank_data.get_routing_number()), sep=' ') print()
def main(): #get start balance from user start_bal= float(input('Enter your starting balance: ')) #create bank account object savings=bankaccount.BankAccount(start_bal) #deposit the users paycheck pay=float(input('How much did you get paid?: ')) print('Depositing {0:.2f} into your account'.format(pay)) savings.deposit(pay) #display the balance print('Your account balance is {0:.2f}'.format(savings.get_balance(),sep='')) #get the amount to withdraw cash=float(input('How much would you like to withdraw? :')) print('Withdrawing from account...') savings.withdraw(cash) #display the balance print('Your account balance is {0:.2f}'.format(savings.get_balance(),sep=''))
def main(): # get the starting balance start_bal = float(input('Enter your starting balance:\n')) # Instantiate bank account savings = bankaccount.BankAccount(start_bal) #Deposit the users paycheck pay = float(input('How much were you paid this week?\n')) print('I will deposit this in your account') savings.deposit(pay) #Display the balance print(savings) #Withdraw cash cash = input('How much would you want to withdraw?\n') print('I will with draw this from your account.') savings.withdraw(cash) #Display the balance print(savings)
def main(): start_bal = float(input('Enter your starting balance: ')) savings = bankaccount.BankAccount(start_bal) pay = float(input('How much did you pay for this week? ')) savings.deposit(pay) print('Your account balance is $', format(savings.getBalance(), '.2f'), sep='') cash = float(input('How much would you like to withdraw? ')) print('I will withdraw from the account ') savings.withdraw(cash) print('Your account balance is $', format(savings.getBalance(), '.2f'), sep='')
import bankaccount import random account = bankaccount.BankAccount(10, 50, 'John Smith') fCount = 0 for i in range(100): choice = random.randint(0, 1) ammount = random.randint(1, 20) if choice == 1: account.deposit(ammount) elif choice == 0: withdrawFlag = account.withdraw(ammount) if withdrawFlag == False: fCount += 1 print("fail count ", fCount) print("Balance ", account.getBalance())