fin
This commit is contained in:
BIN
DEV2.1/Classe_objet/Journee.class
Normal file
BIN
DEV2.1/Classe_objet/Journee.class
Normal file
Binary file not shown.
11
DEV2.1/Classe_objet/Journee.java
Normal file
11
DEV2.1/Classe_objet/Journee.java
Normal file
@@ -0,0 +1,11 @@
|
||||
import date.Date;
|
||||
|
||||
public class Journee {
|
||||
public static void main(String[] args) {
|
||||
Date mardi = new Date(args[0],args[1],args[2]);
|
||||
Date mardi2 = new Date(args[0],args[1],args[2]);
|
||||
System.out.println(mardi.toString());
|
||||
System.out.println(mardi.Lendemain());
|
||||
mardi.Meme(mardi2);
|
||||
}
|
||||
}
|
||||
BIN
DEV2.1/Classe_objet/Progression.class
Normal file
BIN
DEV2.1/Classe_objet/Progression.class
Normal file
Binary file not shown.
15
DEV2.1/Classe_objet/Progression.java
Normal file
15
DEV2.1/Classe_objet/Progression.java
Normal file
@@ -0,0 +1,15 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import compteur.Compteur;
|
||||
|
||||
public class Progression {
|
||||
public static void main(String[] args) {
|
||||
Compteur n = new Compteur();
|
||||
for (int j = 0;j <= 5;j++)
|
||||
n.plusUn();
|
||||
for (int i = 5;i < 10;i++){
|
||||
System.out.println(n.toString());
|
||||
n.plusUn();
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
DEV2.1/Classe_objet/compteur/Compteur.class
Normal file
BIN
DEV2.1/Classe_objet/compteur/Compteur.class
Normal file
Binary file not shown.
16
DEV2.1/Classe_objet/compteur/Compteur.java
Normal file
16
DEV2.1/Classe_objet/compteur/Compteur.java
Normal file
@@ -0,0 +1,16 @@
|
||||
package compteur;
|
||||
public class Compteur {
|
||||
// attribut
|
||||
private int compte;
|
||||
// méthode
|
||||
public void plusUn() {
|
||||
this.compte++;
|
||||
}
|
||||
public Compteur() {
|
||||
this.compte = 0;
|
||||
}
|
||||
// autre méthode
|
||||
public String toString() {
|
||||
return Integer.toBinaryString(this.compte);
|
||||
}
|
||||
}
|
||||
BIN
DEV2.1/Classe_objet/date/Date.class
Normal file
BIN
DEV2.1/Classe_objet/date/Date.class
Normal file
Binary file not shown.
72
DEV2.1/Classe_objet/date/Date.java
Normal file
72
DEV2.1/Classe_objet/date/Date.java
Normal file
@@ -0,0 +1,72 @@
|
||||
package date;
|
||||
public class Date {
|
||||
private String jour;
|
||||
private String mois;
|
||||
private String annee;
|
||||
|
||||
public Date(String j, String m, String a) {
|
||||
this.jour = j;
|
||||
this.mois = m;
|
||||
this.annee = a;
|
||||
}
|
||||
public void Meme(Date date2){
|
||||
int error = 0;
|
||||
if (this.jour != date2.jour)
|
||||
error++;
|
||||
else if (this.mois != date2.mois)
|
||||
error++;
|
||||
else if (this.annee != date2.annee)
|
||||
error++;
|
||||
if (error == 0)
|
||||
System.out.println("C'est la même date");
|
||||
else
|
||||
System.out.println("Ce n'est pas la même date");
|
||||
}
|
||||
public String Lendemain(){
|
||||
int an = Integer.parseInt(this.annee);
|
||||
int mo = Integer.parseInt(this.mois);
|
||||
int jo = Integer.parseInt(this.jour);
|
||||
if (mo < 7){
|
||||
if (mo % 2 == 1){
|
||||
if (jo < 31){
|
||||
jo++;
|
||||
}else{
|
||||
jo = 1;
|
||||
mo++;
|
||||
}
|
||||
}else{
|
||||
if (jo < 30){
|
||||
jo++;
|
||||
}else{
|
||||
jo = 1;
|
||||
mo++;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if (mo % 2 == 0){
|
||||
if (jo < 31){
|
||||
jo++;
|
||||
}else{
|
||||
jo = 1;
|
||||
if (mo == 12){
|
||||
mo = 1;
|
||||
an++;
|
||||
}else{
|
||||
mo++;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if (jo < 30){
|
||||
jo++;
|
||||
}else{
|
||||
jo = 1;
|
||||
mo++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return an+"-"+mo+"-"+jo;
|
||||
}
|
||||
public String toString() {
|
||||
return this.annee+"-"+this.mois+"-"+this.jour;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user