-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial foundation for bank application
- Loading branch information
1 parent
8376ff7
commit 5b4bd89
Showing
1 changed file
with
13 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,25 @@ | ||
##objects and classes and object oriented programming | ||
##non object oriented programming you would type your data in a series | ||
|
||
class BankAccount | ||
|
||
def initialize(name) | ||
@transactions = [] | ||
@balance = 50 | ||
|
||
end | ||
@balance = 0 | ||
end | ||
|
||
def deposit | ||
print "How much would you like to deposit? " | ||
puts "How much would you like to deposit?" | ||
amount = gets.chomp | ||
@balance += .to_f | ||
@balance + amount | ||
puts "$ #{amount} deposited" | ||
@balance += amount.to_f | ||
puts "$#{amount} has been deposited." | ||
end | ||
|
||
def show_balance | ||
puts "Your Current balance is #{@balance}" | ||
puts "Your current balance is #{@balance}" | ||
end | ||
end | ||
|
||
bank_account = BankAccount.new('Blake Jackovitch') | ||
bank_account.class | ||
bank_account = BankAccount.new("Chocolate Tomato") | ||
bank_account.class | ||
|
||
bank_account.deposit | ||
bank_account.show_balance | ||
bank_account.deposit | ||
bank_account.show_balance | ||
|