-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaccounts.rb
More file actions
74 lines (49 loc) · 1.19 KB
/
Copy pathaccounts.rb
File metadata and controls
74 lines (49 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
class Person
attr_accessor :name, :cash_on_you
attr_writer :name, :cash_on_you
def initialize(name, cash_on_you)
@name = name
@cash_on_you = cash_on_you
puts "Hi, #{name}. You have $#{cash_on_you}"
end
def name
@name
end
def cash_on_you
@cash_on_you
end
end
#---------------CLASS_SEPERATING_LINE----------------
class Bank
attr_accessor :bank_name, :name
attr_writer :account, :amount
attr_reader :amount
def initialize(bank_name)
@bank_name = bank_name
puts "#{bank_name} bank has just been created!"
@account = []
end
def open_account(account)
@account.push(account)
puts "#{account.name}, thanks for opening an account at #{self.bank_name}"
end
def bank_name
@bank_name
end
def deposit
end
def withdraw()
end
def transfer()
end
end
#----------------------------OUTPUT_BELOW------------------------------------------
#accounts_below
woodforest = Bank.new("Woodforest")
wells_fargo = Bank.new("Well's Fargo")
me = Person.new("Brandon", 700)
aaron = Person.new("Aaron", 1200)
woodforest.open_account(me)
woodforest.open_account(aaron)
wells_fargo.open_account(me)
wells_fargo.open_account(aaron)