Advertisement
Mashudi

UMLTabungan

Mar 18th, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.70 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6.  
  7. /**
  8.  *
  9.  * @author sudonym
  10.  */
  11. public class Tabungan {
  12.     int saldo;
  13.    
  14.     public Tabungan(int initsaldo){
  15.         this.saldo = initsaldo;
  16.     }
  17.    
  18.     public int getSaldo(){
  19.         return saldo;
  20.     }
  21.    
  22.     public void simpanUang(int jumlah){
  23.         this.saldo = saldo + jumlah;
  24.     }
  25.    
  26.     public boolean ambilUang(int jumlah){
  27.         if(jumlah > this.saldo){
  28.             return false;
  29.         }else{
  30.             this.saldo -= jumlah;
  31.             return true;
  32.         }
  33.     }
  34.    
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement