From 822bf985b4947d09e7086bf91019d6966efd43ed Mon Sep 17 00:00:00 2001 From: JohnnyMurph22 <98765051+JohnnyMurph22@users.noreply.github.com> Date: Tue, 1 Mar 2022 20:59:06 -0800 Subject: [PATCH 01/29] lab12 ATM w/ Version 2 --- Code/johnathan/python/lab12.py | 81 ++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 Code/johnathan/python/lab12.py diff --git a/Code/johnathan/python/lab12.py b/Code/johnathan/python/lab12.py new file mode 100644 index 00000000..4d1031cf --- /dev/null +++ b/Code/johnathan/python/lab12.py @@ -0,0 +1,81 @@ + +# # Lab 12: ATM w/ Version 2 + +# Let's represent an ATM with a class containing two attributes: +# a balance and an interest rate. A newly created account will default to a balance of 0 +# and an interest rate of 0.1%. Implement the initializer, as well as the following functions: + + +class ATM: + def __init__(self): + self.balance = 0 + self.interest_rate = 0.1 + self.transactions = [] #Add a new method `print_transactions()` to your class for printing out the list of transactions, + +# - `check_balance()` returns the account balance + def check_balance(self): + account_balance = self.balance + return account_balance +# - `deposit(amount)` deposits the given amount in the account + def deposit(self, amount): + self.transactions.append(f'User deposited ${amount}') + self.balance = self.balance + amount + return amount +# - `check_withdrawal(amount)` returns true if the withdrawn amount won't +# put the account in the negative + def check_withdrawal(self, amount): + if amount < self.balance >= 0: + return True + else: + return False +#withdraws the amount from the account and returns it + def withdraw(self, amount): + self.transactions.append(f'User withdrew ${amount}') + amount = self.balance - amount + return amount +#returns the amount of interest calculated on the account + def calc_interest(self): + amount = self.interest_rate * self.balance + return amount +#print user transactions + def user_transaction(self): + return self.transactions + +atm = ATM() # create an instance of our class +print('Welcome to the ATM') +while True: + command = input('Enter a command: ') + if command == 'balance': + balance = atm.check_balance() # call the check_balance() method + print(f'Your balance is ${balance}') + elif command == 'deposit': + amount = float(input('How much would you like to deposit? ')) + atm.deposit(amount) # call the deposit(amount) method + print(f'Deposited ${amount}') + elif command == 'withdraw': + amount = float(input('How much would you like ')) + if atm.check_withdrawal(amount): # call the check_withdrawal(amount) method + atm.withdraw(amount) # call the withdraw(amount) method + print(f'Withdrew ${amount}') + else: + print('Insufficient funds') + elif command == 'interest': + amount = atm.calc_interest() # call the calc_interest() method + atm.deposit(amount) + print(f'Accumulated ${amount} in interest') + elif command == 'help': + print('Available commands:') + print('balance - get the current balance') + print('deposit - deposit money') + print('withdraw - withdraw money') + print('interest - accumulate interest') + print('exit - exit the program') + elif command == 'exit': + break + else: + print('Command not recognized') + + + + + From d3e445dab6709c9e742af25a8d594481cc3a9874 Mon Sep 17 00:00:00 2001 From: JohnnyMurph22 <98765051+JohnnyMurph22@users.noreply.github.com> Date: Fri, 4 Mar 2022 17:40:16 -0800 Subject: [PATCH 02/29] Lab 12 corrections made, per @IrronWilliams comments, added print transaction list + ATM withdraws subtract from balance --- Code/johnathan/python/lab12.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Code/johnathan/python/lab12.py b/Code/johnathan/python/lab12.py index 4d1031cf..3c91001a 100644 --- a/Code/johnathan/python/lab12.py +++ b/Code/johnathan/python/lab12.py @@ -31,8 +31,8 @@ def check_withdrawal(self, amount): #withdraws the amount from the account and returns it def withdraw(self, amount): self.transactions.append(f'User withdrew ${amount}') - amount = self.balance - amount - return amount + self.balance = self.balance - amount + return self.balance #returns the amount of interest calculated on the account def calc_interest(self): amount = self.interest_rate * self.balance @@ -63,12 +63,16 @@ def user_transaction(self): amount = atm.calc_interest() # call the calc_interest() method atm.deposit(amount) print(f'Accumulated ${amount} in interest') + elif command == 'transactions': + transactions = atm.user_transaction() # call the user_transactions() method + print(transactions) elif command == 'help': print('Available commands:') print('balance - get the current balance') print('deposit - deposit money') print('withdraw - withdraw money') print('interest - accumulate interest') + print('transactions - transaction history') print('exit - exit the program') elif command == 'exit': break From 42063c9a377973535286f668cceb981d5ea485c6 Mon Sep 17 00:00:00 2001 From: JohnnyMurph22 <98765051+JohnnyMurph22@users.noreply.github.com> Date: Fri, 4 Mar 2022 20:21:56 -0800 Subject: [PATCH 03/29] committing lab 1 HTML/CSS --- Code/johnathan/HTML/lab1.css | 46 ++++++++++++++++++++++ Code/johnathan/HTML/lab1.html | 73 +++++++++++++++++++++++++++++++++++ 2 files changed, 119 insertions(+) create mode 100644 Code/johnathan/HTML/lab1.css create mode 100644 Code/johnathan/HTML/lab1.html diff --git a/Code/johnathan/HTML/lab1.css b/Code/johnathan/HTML/lab1.css new file mode 100644 index 00000000..8bbab5e6 --- /dev/null +++ b/Code/johnathan/HTML/lab1.css @@ -0,0 +1,46 @@ +/* - Center the entire content of the body */ +h1 { + text-align: center; + font-family: "times new roman"; + text-emphasis-style: ""; +} + +.pretag { + font-size: larger; +} +/* - Change the bullet points on the list of places. --> */ +h3 { + list-style-type: "circle"; +} + +/* - Add a background image */ +body { + background-image: url("https://wallpaperset.com/w/full/7/9/b/18243.jpg"); + background-size: auto; + color: whitesmoke; + font-family: "Times New Roman"; + padding-top: 50px; + padding-right: 30px; + padding-bottom: 50px; + padding-left: 80px; +} +/* - Add a rounded border to the picture. */ +img { + border-radius: 100px; + display: block; + width: 200px; + text-align: right; + margin: 0 auto; + /* x-offset, y-offset, blur radius, spread, color */ + box-shadow: 4px 4px 4px 0 rgba(0, 0, 0, 0.291); +} +/* - Pick a color scheme and modify the background, body text, and link text color. */ +.center-link { + display: block; + text-align: center; + margin-bottom: 16px; +} + +a { + color: orange; +} diff --git a/Code/johnathan/HTML/lab1.html b/Code/johnathan/HTML/lab1.html new file mode 100644 index 00000000..8a8b58d8 --- /dev/null +++ b/Code/johnathan/HTML/lab1.html @@ -0,0 +1,73 @@ + + + + + + + Tyrion Lannister + + + + + +
+

Tyrion Lannister Bio

+ + +

Lord Tyrion Lannister, also known by the nicknames the Halfman or the Imp and + the alias Hugor Hill, is a fictional character in the A Song of Ice and Fire series + of epic fantasy novels by American author George R. R. Martin, and its television + adaptation Game of Thrones, where he is portrayed by American actor Peter Dinklage. + Introduced in A Game of Thrones (1996), Tyrion is a prominent point of view character + in the series, having the most viewpoint chapters in the first five published novels. + He is one of a few prominent characters not included in A Feast for Crows (2005) but + returned in A Dance with Dragons (2011), and is confirmed to appear in the forthcoming + sixth novel The Winds of Winter. Tyrion developed from a character concept Martin + had while writing the 1981 novel Windhaven. He is Martin's favorite character in the + series. + + Checkout the Tyrion_Bio for more info. +

+ + + +

+ +
  " That’s what I do. I drink, and I know things. " 
+ + + Halfman +

+ +

+ + Places lived: + +

+ + + + + + + + + + Class Kiwi Fan Page + + +