1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
import java.util.*;
enum TypeOperation { Credit , Debit } ;
// fichier Operation.java
public class Operation
{
// attributs ( private )
private float somme;
private TypeOperation type;
private String date ;
// constructeurs
public Operation ( float somme , TypeOperation type )
{
this.somme = somme ;
this.type = type ;
this.date = new Date().toString();
//version formatée de la date
/*Calendar c ;
c = Calendar.getInstance() ;
this.date = c.get ( Calendar.DAY_OF_MONTH ) + "/" +
( c.get ( Calendar.MONTH ) + 1 ) + "/" +
c.get ( Calendar.YEAR ) ;*/
}
// accesseurs en lecture
public float getSomme ()
{
return somme ;
}
public TypeOperation getType ()
{
return type ;
}
public String getDate ( )
{
return date ;
}
public String toString()
{
return type +" " + somme + " Date : " + date ;
}
} |
Partager