%."(/.''%' )*-.') "/0"!/.''%'1) - - PDF document

0 1
SMART_READER_LITE
LIVE PREVIEW

%."(/.''%' )*-.') "/0"!/.''%'1) - - PDF document

+!,$-""%%%./ %."(/.''%' )*-.') "/0"!/.''%'1) * !. !%.%*


slide-1
SLIDE 1
  • !"#$ %!"%!%&'"( )*

+!,$-""%%%./

%."(/.''%'

)*-.') "/0"!/.''%'1) * !.

!%.%* 2

#.("%(."3"(...).'%4

).5.!! '

%.%.!/.''%'!")"(-%$$%"%'

.)%-.6"'47.//8 ).5.!! '

+!,$-""%%%./

%4""(/.''%'

  • %%9%9.#$/%'-2'* -2

* 2!/.''

  • "'"'-%2.** .%2!/.''

+!,$-""%%%./

9.#$/%:;/.''%4"""*.9

1 class Classname 2 def initialize(var1, var2, ..., varn) 3 @variable_1 = var1 4 @variable_2 = var2 5 ... 6 @variable_n = varn 7 end 8 9 def method_1 10 # code 11 end 12 13 def method_2 14 # code 15 end 16 end

+!,$-""%%%./

slide-2
SLIDE 2
  • /.''%4""";9.#$/%:

<%2"//%9$/.".

'"(.%9.#$/%4.).5 .!! #..(%#%'*'%#

"'1!%.%./.''!.//% %-%.$".//%%==

9.#$/%:;!! >%'"? 1 class Account 2 def initialize(balance) 3 @balance = balance 4 end 5 end

+!,$-""%%%./

/.''%4"""

  • %6.".)/%'"'"%-%$.%-%'"'.4%"""./"3%

.%-%-..%.''"(%2-% "'."."(.)@%!

1 class Account 2 def initialize(balance) 3 @balance = balance 4 end 5 end

!' !

+!,$-""%%%./

$%"%'4.'."."

)@%!2"//-.6%.6.".)/%!.//%78

2"-.2-"!-* -.6%.''"( '"( .$..#%%

1 class Account 2 def initialize(balance) 3 @balance = balance 4 end 5 end

+!,$-""%%%./

/.'''."."

  • %'$%!"./!-..!%1A1"' '%""!.%-."

"'.$..#%%.6."/.)/%.//#%-'4-%!/.''

  • ..% '%)*-%)@%!

>.".)/%''."(2"-A.%!.//%

  • %*.%.6."/.)/%#%-'2"-"-%!/.''

1 class Account 2 def initialize(balance) 3 @balance = balance 4 end 5 end

+!,$-""%%%./

slide-3
SLIDE 3
  • /.'''."."

B !."'.".%.)@%!4-%

!! !/.''-%'.#%2.** !%.% %2'"('...*'; bob = Account.new(10.00)

+%;B "-.6%%4"%.C%- !.//%7%28:-."'%4* )* )*:,

+!,$-""%%%./

/.'''."."

  • %$..#%%$.''%"-%

$.%-%'"'2"//)%!#%-%"""./ )./.!%4)D'.!! bob = Account.new(10.00)

+!,$-""%%%./

...C%-'

2-.2%52-2

%4"%-%!! !/.''12%'- /!'"% "'4 !"./"*;

<-.6.".)/%'2%

%%E

<-.#%-'2 /)%

'%4 /E

!/.''%%'

$."! /.6.".)/%'. #%-'

  • % "'-%

%9!%$"-"' /%

/.''%'.% '%

( $ . .''!".%2"-"" %!#$.#%./"3% ' ! %

C%-'.6.".)/%'

.%"!.%)*-"'(./

+!,$-""%%%./

...C%-'

  • %!! !/.''! / '%#%

6.".)/%''%"4#."' !-.';

.#%

  • % #)%

!"./'%! "* #)% C""# #%F "%)./.!%

+!,$-""%%%./

slide-4
SLIDE 4
  • 9.#$/%:;!! >%'"?

1 class Account 2 def initialize(balance,name,phone_number) 3 @balance = balance 4 @name = name 5 @phone_number = phone_number 6 end 7 end

<%"'%2%2 6.".)/%'-%!/.''

!' !

+!,$-""%%%./

9.#$/%:;!! >%'"?

1 class Account 2 def initialize(balance, name, phone_number) 3 @balance = balance 4 @name = name 5 @phone_number = phone_number 6 end 7 end

name . phone_number 2"//

  • %/$#.5%%.!-

"'."." "F %

+!,$-""%%%./

...C%-'

%2"'."."4.)@%!4#-%!! !/.'';

bob = Account.new(10.00, "Bob", 7166349483)

%(%4 //*1-%%"'.)'/ %/* 2%!.2"-

  • "'!/.''1%9!%$4"'."."(%2)@%!'

2 /)% '%4 /-.6%'#%%./4 !"./"*+":%:1

)%"(.)/%2"-.2.%$'",

+!,$-""%%%./

9.#$/%:;!! >%'"?

1 class Account 2 def initialize(balance, name, phone_number) 3 @balance = balance 4 @name = name 5 @phone_number = phone_number 6 end 7 8 def deposit(amount) 9 # code 10 end 11 12 def withdraw(amount) 13 # code 14 end 15 end

+!,$-""%%%./

slide-5
SLIDE 5
  • G

...C%-';#$/%#%"(C%-'

!%-%%."/'4-%!! !/.''

.%4"./"3%1.$(.##%!. '%" 2"- 52"(-%!%

  • %*/*%%52;

..%%%"""./"3%-%!/.'' ..%%%4%.!-#%-"-%!/.''

+!,$-""%%%./

9.#$/%:G;!! >%'"?

1 class Account 2 def initialize(balance, name, phone_number) 3 @balance = balance 4 @name = name 5 @phone_number = phone_number 6 end 7 8 def deposit(amount) 9 @balance += amount 10 end 11 12 def withdraw(amount) 13 @balance -= amount 14 end 15 end

+!,$-""%%%./

21"""./"3%-%!/.''%' '%-%'%#%-';

irb(main):003:0> require ’account_4.rb’ => true irb(main):004:0> mary_account = Account.new(500, "Mary", 8181000000) => #<Account:0x3dfa68 @balance=500, @name="Mary", @phone_number=8181000000> irb(main):005:0> mary_account.deposit(200) => 700 irb(main):006:0> mary_account => #<Account:0x3dfa68 @balance=700, @name="Mary", @phone_number=8181000000>

+!,$-""%%%./

...C%-';#$/%#%"(C%-'

21/%D'!%.%.#%-#.5%-% $ '"#$/%;

9.#$/%:H;"'$/.*#%- 1 def display() 2 puts "Name: " + @name 3 puts "Phone Number: " + @phone_number.to_s 4 puts "Balance: " + @balance.to_s 5 end

+!,$-""%%%./

slide-6
SLIDE 6
  • H

...C%-';#$/%#%"(C%-'

%D' '%-%%2"'$/.*#%- $ -%

.!! .."-%)@%!';

bob_account = Account.new(500, "Bob", 8181000000) mary_account = Account.new(500, "Mary", 8881234567) bob_account.withdraw(200) mary_account.deposit(200) bob_account.display() mary_account.display()

+!,$-""%%%./

...C%-';#$/%#%"(C%-'

<%2"//#6%#%*4#)C.*D'.!! ; 2#%-'.%!.//%;2"-.2%$'"

bob_account = Account.new(500, "Bob", 8181000000) mary_account = Account.new(500, "Mary", 8881234567) bob_account.withdraw(200) mary_account.deposit(200) bob_account.display() mary_account.display()

+!,$-""%%%./

...C%-';#$/%#%"(C%-'

<%! /#.5%.#%--.%'

)-.-%'.#%"#%1) -"'2 / #%.-%#%-!.//' 4-%'.#%!/.''

#%-!.!.//# /"$/%"44%%

"'.!%'4-%'.#%!/.'')* "-%#%-

!.'%12%%%2"'.!%'4-%

'.#%!/.''1'2%2"//.'4%%.'. $..#%%

+!,$-""%%%./

9.#$/%:I;.'4%C%-

2$.''"-%)@%!;

1 def transfer(amount, target_account) 2 @balance -= amount 3 target_account.deposit(amount) 4 end

%4 %4"%#%-'% % .6./ %-%"65"('.%#%: )."-"'6./ %1.#%-# ')% %4"%-.% '.6./ %:

+!,$-""%%%./

slide-7
SLIDE 7
  • I

9.#$/%:J;. 'C%-

  • %"#$/%#%."4 #%-;

1 def status 2 return @balance 3 end

  • %% !' !% '-%6./ %4

@balance -%"65"('.%#%: %!. '%-%%"'/!./6%""( $..#%%!.//%@balance1-% (/)./6./ %4@balance "' .!!%''%:

+!,$-""%%%./

##.*

/.''%'!.)%!%.%)*.

6".-%

/.''%'.%#%.

'(%-%

  • %$!%''4"'."."()@%!'!%.%'

)@%!' 2"--%"..

!%.)@%!-.')%%!%.%1"

.)'.!'-%%."/'-% $(.#-. '%'"

B !. '%.)@%!2"- '%%"(-%

%."/'4-.)@%!"%!/*

+!,$-""%%%./