Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.51 KB | None | 0 0
  1. //conto di risparmio
  2. public class SavingAccount {
  3.     //creo i campi di esemplare
  4.     private double balance;
  5.     private double interest;
  6.  
  7.     //costruttori
  8.  
  9.     public SavingAccount (double initialBalance, double interest) {
  10.         this.balance=initialBalance;
  11.         this.interest=interest;
  12.     }
  13.  
  14.  
  15.     //aggiungo metodo getbalance
  16.     public double getBalance (){
  17.         return balance;
  18.     }
  19.  
  20.     //aggiungo metodo add interest
  21.     public double addInterest (){
  22.         this.balance=this.balance + (this.balance*interest/100);
  23.         return balance;
  24.     }  
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement