Advertisement
Guest User

Untitled

a guest
Nov 1st, 2014
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.62 KB | None | 0 0
  1. public class Date {
  2.  
  3.     int jours; /// les jours
  4.     int mois ; //// le mois
  5.     int annee ; //// l'annnĂ©e
  6.  
  7.     public Date(int j, int m, int a) {
  8.         jours = j ;
  9.         mois = m ;
  10.         annee = a ;
  11.     }
  12.  
  13.     public String toString() {
  14.         String str = "" ;
  15.  
  16.         if (jours < 10) {
  17.             str = "0" + jours + "/" ;
  18.         }
  19.         else {
  20.             str = jours + "/" ;
  21.         }
  22.  
  23.         if (mois < 10) {
  24.             str = str + "0" + mois + "/" ;
  25.         }
  26.         else {
  27.             str = str + mois + "/" ;
  28.         }
  29.  
  30.         str = str + annee ;
  31.  
  32.         return str ;
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement