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 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 new file mode 100644 index 0000000..8c518de --- /dev/null +++ b/src/Natation.java @@ -0,0 +1,51 @@ +import java.util.ArrayList; +import java.util.GregorianCalendar; + +public class Natation extends Séance { + public GregorianCalendar date; + int duree; + 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 ); + } + 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; + } + Natation(){ + fractions = new ArrayList(); + } + + void add(Fraction s){ + this.fractions.add(s); + } + + public GregorianCalendar getDate() { + return date; + } + public void setDate(GregorianCalendar date) { + this.date = date; + } + + public int getDuree() { + return duree; + } + public int getDistance() { + return distance; + } + public void affiche(){ + 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."); + } + + + + } + + + 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 @@ public abstract class S 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(); + } }