Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Projet_Java
Projet de java IGI452 2015
Heheee
ceci est un test
30 changes: 30 additions & 0 deletions src/Fraction.java
Original file line number Diff line number Diff line change
@@ -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;
}
}
51 changes: 51 additions & 0 deletions src/Natation.java
Original file line number Diff line number Diff line change
@@ -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<Fraction> 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<Fraction>();
}

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.");
}



}



4 changes: 3 additions & 1 deletion src/Séance.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
abstract void affiche();
abstract int getDuree();
abstract int getDistance();
abstract String getType();
abstract GregorianCalendar getDate();
public String getType() {
return null;
}
}
2 changes: 2 additions & 0 deletions src/TypeNage.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
public enum TypeNage{BRASSE, CRAWL, DOS, PAPILLION};
//liste des types de nage
9 changes: 9 additions & 0 deletions src/main.java
Original file line number Diff line number Diff line change
@@ -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();
}

}