This commit is contained in:
2024-03-18 13:54:22 +01:00
parent eb581c8a31
commit a28bef01d7
69 changed files with 855 additions and 5 deletions

Binary file not shown.

View 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);
}
}

Binary file not shown.

View 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();
}
}
}

Binary file not shown.

View 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);
}
}

Binary file not shown.

View 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;
}
}