Announcement

Collapse
No announcement yet.

SavingsAccount

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • SavingsAccount

    main
    PHP Code:
    import bank.SavingsAccount;
    public class 
    test {

        public static 
    void main (String [] input_data){

            
    SavingsAccount conto = new SavingsAccount(1000,3.45);
            
    System.out.println("saldo = " +  conto.get_balance());
                
    conto.deposit(23);
            
    System.out.println("saldo con deposito di 23 = " conto.get_balance());
                
    conto.withdraw(40);
            
    System.out.println("saldo con withdarw di 40 = " conto.get_balance());
                
    conto.addInterest();
            
    System.out.println("saldo con interesse = " conto.get_balance());


        }

    SavingsAccount class
    PHP Code:
    package bank;
    public class 
    SavingsAccount {


        
    ////////////// constructor
        
    public SavingsAccount (double in_saldodouble in_interest){
               
    saldo in_saldo;
               
    interest in_interest;

        }

         public 
    void deposit double in_deposit){
              
    saldo+=in_deposit;

         }
         public 
    void withdraw double in_withdraw ){
               
    saldo-=in_withdraw;

         }
         public 
    double get_balance ( ){
                return 
    saldo;

         }

        
    /////////////   aggiungi interesse trimestrale al conto
         
    public void addInterest () {
             
    saldo += (((saldo 100) * interest)/4);

         }


    private 
    double saldo;
    private 
    double interest;


    | VFX Artist, C++ Programmer, HW Overclocker | Web: xgiovio.com Email: xgiovio@gmail.com Twitter: @xgiovio
Working...
X

Google Profile


My name is Giovanni Di Grezia, but people call me xgiovio.

Here is my homepage:.

I'm a VFX Artist and Software Developer.

Giovanni Di Grezia