class SavingsAccount
main
PHP Code:
package bank;
import java.io.PrintStream;
import java.util.Scanner;
public class SavingsAccount {
////////////// constructor
public SavingsAccount (double in_saldo, double 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);
}
public static SavingsAccount create_object ( Scanner stream){
double saldo = stream.nextDouble();
double interesse = stream.nextDouble();
return new SavingsAccount(saldo,interesse);
}
public void print ( PrintStream stream){
stream.println (saldo);
stream.println (interest);
}
private double saldo;
private double interest;
}
PHP Code:
import bank.SavingsAccount;
import java.util.Scanner;
/**
* Created with xgiovio.macbookair.
* User: xgiovio
* Date: 23/09/13
* Time: 14:57
*/
public class test {
public static void main (String [] input_data){
SavingsAccount obj = SavingsAccount.create_object( new Scanner(System.in));
obj.print(System.out);
}
}