From f2e56906727df49f414371a03050dbd3781fe71b Mon Sep 17 00:00:00 2001 From: Xiway Date: Thu, 23 Apr 2015 15:16:18 +0200 Subject: [PATCH 1/3] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index a567783..e87a1f8 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ # Projet_Java Projet de java IGI452 2015 Heheee +ceci est un test From d4fade0e55d759ac9adc4e2eaf9a716aad765a6c Mon Sep 17 00:00:00 2001 From: Xiway Date: Thu, 7 May 2015 08:44:58 +0200 Subject: [PATCH 2/3] classe natation --- src/Natation.java | 58 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 src/Natation.java diff --git a/src/Natation.java b/src/Natation.java new file mode 100644 index 0000000..9dac5e5 --- /dev/null +++ b/src/Natation.java @@ -0,0 +1,58 @@ +import java.util.GregorianCalendar; + + +public class Natation extends Séance { + private GregorianCalendar date; + int duree; + private String Type = ""; + private int distance; + String _n = System.getProperty("line.separator"); + + public Natation(int jour, int mois, int annee, int heure, int minute){ + date = new GregorianCalendar(annee, mois, jour, heure, minute, 0 ); + } + public Natation(int jour, int mois, int annee, int heure, int minute, int duree, int distance){ + this(jour, mois, annee, heure, minute); + this.duree = duree; + this.distance = distance; + } + + + public GregorianCalendar getDate() { + return date; + } + public void setDate(GregorianCalendar date) { + this.date = date; + } + + public int getDuree() { + return duree; + } + public void setDuree(int duree) { + this.duree = duree; + } + public int getDistance() { + return distance; + } + public void setDistance(int distance) { + this.distance = distance; + } + public String getType() { + return Type; + } + public void setType(String type) { + Type = type; + } + + public void affiche(){ + // Je te laisse t'occuper de l'affichage de la date System.out.println("Séance du " + this.date.get(GregorianCalendar.DAY_OF_MONTH) + "/" + this.date.get(GregorianCalendar.MONTH) + "/"+ this.date.get(GregorianCalendar.YEAR) +" de type natation :"); + System.out.println("Distance totale parcourue : "+this.distance+" m."); + System.out.println("Duree : "+this.duree + " minutes."); + System.out.println("Type de nage : "+this.Type+"."); + } + + + } + + + From 1745d9389d9f0d263457312f295d57fb1497c205 Mon Sep 17 00:00:00 2001 From: Xiway Date: Thu, 7 May 2015 11:50:13 +0200 Subject: [PATCH 3/3] ok natation/fractions --- src/Fraction.java | 30 ++++++++++++++++++++++++++++++ src/Natation.java | 33 +++++++++++++-------------------- "src/S\303\251ance.java" | 4 +++- src/TypeNage.java | 2 ++ src/main.java | 9 +++++++++ 5 files changed, 57 insertions(+), 21 deletions(-) create mode 100644 src/Fraction.java create mode 100644 src/TypeNage.java diff --git a/src/Fraction.java b/src/Fraction.java new file mode 100644 index 0000000..cd0a958 --- /dev/null +++ b/src/Fraction.java @@ -0,0 +1,30 @@ +public class Fraction{ + int duree; + int distance; + TypeNage type; + + + public Fraction(TypeNage type,int duree, int distance){ + this.type=type; + this.duree=duree; + this.distance=distance; + } + public int getDuree() { + return duree; + } + public void setDuree(int duree) { + this.duree = duree; + } + public int getDistance() { + return distance; + } + public void setDistance(int distance) { + this.distance = distance; + } + public TypeNage getType() { + return type; + } + public void setType(TypeNage type) { + this.type = type; + } +} \ No newline at end of file diff --git a/src/Natation.java b/src/Natation.java index 9dac5e5..8c518de 100644 --- a/src/Natation.java +++ b/src/Natation.java @@ -1,12 +1,12 @@ +import java.util.ArrayList; import java.util.GregorianCalendar; - public class Natation extends Séance { - private GregorianCalendar date; + public GregorianCalendar date; int duree; - private String Type = ""; - private int distance; + public int distance; String _n = System.getProperty("line.separator"); + public ArrayList fractions; public Natation(int jour, int mois, int annee, int heure, int minute){ date = new GregorianCalendar(annee, mois, jour, heure, minute, 0 ); @@ -16,8 +16,14 @@ public Natation(int jour, int mois, int annee, int heure, int minute, int duree, this.duree = duree; this.distance = distance; } + Natation(){ + fractions = new ArrayList(); + } + + void add(Fraction s){ + this.fractions.add(s); + } - public GregorianCalendar getDate() { return date; } @@ -28,30 +34,17 @@ public void setDate(GregorianCalendar date) { public int getDuree() { return duree; } - public void setDuree(int duree) { - this.duree = duree; - } public int getDistance() { return distance; } - public void setDistance(int distance) { - this.distance = distance; - } - public String getType() { - return Type; - } - public void setType(String type) { - Type = type; - } - public void affiche(){ - // Je te laisse t'occuper de l'affichage de la date System.out.println("Séance du " + this.date.get(GregorianCalendar.DAY_OF_MONTH) + "/" + this.date.get(GregorianCalendar.MONTH) + "/"+ this.date.get(GregorianCalendar.YEAR) +" de type natation :"); + System.out.println("Séance du " + this.date.get(GregorianCalendar.DAY_OF_MONTH) + "/" + this.date.get(GregorianCalendar.MONTH) + "/"+ this.date.get(GregorianCalendar.YEAR) +" de type natation :"); System.out.println("Distance totale parcourue : "+this.distance+" m."); System.out.println("Duree : "+this.duree + " minutes."); - System.out.println("Type de nage : "+this.Type+"."); } + } diff --git "a/src/S\303\251ance.java" "b/src/S\303\251ance.java" index 0c8cd23..6df807f 100644 --- "a/src/S\303\251ance.java" +++ "b/src/S\303\251ance.java" @@ -5,6 +5,8 @@ abstract void affiche(); abstract int getDuree(); abstract int getDistance(); - abstract String getType(); abstract GregorianCalendar getDate(); + public String getType() { + return null; + } } diff --git a/src/TypeNage.java b/src/TypeNage.java new file mode 100644 index 0000000..063f165 --- /dev/null +++ b/src/TypeNage.java @@ -0,0 +1,2 @@ +public enum TypeNage{BRASSE, CRAWL, DOS, PAPILLION}; +//liste des types de nage diff --git a/src/main.java b/src/main.java index 665eca8..4d70f3a 100644 --- a/src/main.java +++ b/src/main.java @@ -1,4 +1,13 @@ public class main { + public static void main (String[]args){ + + Fraction f1 = new Fraction(TypeNage.CRAWL, 20, 20); + Fraction f2 = new Fraction(TypeNage.CRAWL,20, 2); + Natation n1 = new Natation(0, 0, 0, 0, 0, 0, 0); + n1.add(f1); + n1.add(f2); + n1.affiche(); + } }