Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add files via upload #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
83 changes: 83 additions & 0 deletions CycleEntry.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.stir.cscu9t4practical1;

import java.util.Calendar;

/**
*
* @author 44752
*/
public class CycleEntry extends Entry {
private String name;
private Calendar dateAndTime;
private float distance;

public CycleEntry (String n, int d, int m, int y, int h, int min, int s, float dist, String ter, String temp) {
super(n, d, m, y, h, min, s,dist);
Calendar inst = Calendar.getInstance();
inst.set(y,m-1,d,h,min,s);
distance = dist;
dateAndTime = inst;
name = n;


tempo = temp;
terrain = ter;
} //constructor
@Override
public String getName () {
return this.name;
} //getName
@Override
public int getDay () {
return this.dateAndTime.get(Calendar.DATE);
} //getDay
@Override
public int getMonth () {
int month = this.dateAndTime.get(Calendar.MONTH) + 1;
return month;
} //getMonth
@Override
public int getYear () {
return this.dateAndTime.get(Calendar.YEAR);
} //getYear
@Override
public int getHour () {
return this.dateAndTime.get(Calendar.HOUR);
} //getHour
@Override
public int getMin () {
return this.dateAndTime.get(Calendar.MINUTE);
} //getMin
@Override
public int getSec () {
return this.dateAndTime.get(Calendar.SECOND);
} //getSec
@Override
public float getDistance () {
return this.distance;
} //getYear
@Override
public String getTerrain(){
return this.terrain;
}
@Override
public String getTempo(){
return this.tempo;
}


@Override
public String getEntry () {
String result = getName()+" cycled " + getDistance() + " km in "
+getHour()+":"+getMin()+":"+ getSec() + " on "
+getDay()+"/"+getMonth()+"/"+getYear()+" on "+getTerrain()+" at "+getTempo()+" tempo\n";
return result;
} //getEntry


}
88 changes: 88 additions & 0 deletions Entry.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
// This class holds information about a single training session
package com.stir.cscu9t4practical1;

import java.util.Calendar;
public class Entry {
private String name;
private Calendar dateAndTime;
private float distance;
String terrain;
String tempo;
int repetitions;
int recovery;
String location;

public Entry (String n, int d, int m, int y, int h, int min, int s, float dist) {
name = n;
Calendar inst = Calendar.getInstance();
inst.set(y,m-1,d,h,min,s);
dateAndTime = inst;
distance = dist;
} //constructor

public String getName () {
return name;
} //getName

public int getDay () {
return dateAndTime.get(Calendar.DATE);
} //getDay

public int getMonth () {
int month = dateAndTime.get(Calendar.MONTH) + 1;
return month;
} //getMonth

public int getYear () {
return dateAndTime.get(Calendar.YEAR);
} //getYear

public int getHour () {
return dateAndTime.get(Calendar.HOUR);
} //getHour

public int getMin () {
return dateAndTime.get(Calendar.MINUTE);
} //getMin

public int getSec () {
return dateAndTime.get(Calendar.SECOND);
} //getSec

public float getDistance () {
return distance;
} //getYear
public String getTempo(){
return tempo;

}
public String getTerrain(){
return terrain;

}
public int getRepetitions(){
return repetitions;

}
public int getRecovery(){
return recovery;

}
public String getWhere(){
return location;

}




public String getEntry () {
String result = getName()+" ran " + getDistance() + " km in "
+getHour()+":"+getMin()+":"+ getSec() + " on "
+getDay()+"/"+getMonth()+"/"+getYear()+"\n";
return result;
} //getEntry



} // Entry
79 changes: 79 additions & 0 deletions SprintEntry.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.stir.cscu9t4practical1;

import java.util.Calendar;

/**
*
* @author 44752
*/
public class SprintEntry extends Entry {
private String name;
private Calendar dateAndTime;
private float distance;

public SprintEntry (String n, int d, int m, int y, int h, int min, int s, float dist, int rep, int rec) {
super(n, d, m, y, h, min, s, dist);
recovery = rec;
repetitions = rep;
Calendar inst = Calendar.getInstance();
inst.set(y,m-1,d,h,min,s);
distance = dist;
dateAndTime = inst;
name = n;
} //constructor
@Override
public String getName () {
return name;
} //getName
@Override
public int getDay () {
return dateAndTime.get(Calendar.DATE);
} //getDay
@Override
public int getMonth () {
int month = dateAndTime.get(Calendar.MONTH) + 1;
return month;
} //getMonth
@Override
public int getYear () {
return dateAndTime.get(Calendar.YEAR);
} //getYear
@Override
public int getHour () {
return dateAndTime.get(Calendar.HOUR);
} //getHour
@Override
public int getMin () {
return dateAndTime.get(Calendar.MINUTE);
} //getMin
@Override
public int getSec () {
return dateAndTime.get(Calendar.SECOND);
} //getSec
@Override
public float getDistance () {
return distance;
} //getYear
@Override
public int getRepetitions(){
return this.repetitions;
}
@Override
public int getRecovery(){
return this.recovery;
}

@Override
public String getEntry () {
String result = getName()+" sprinted " + getDistance() + " km in "
+getHour()+":"+getMin()+":"+ getSec() + " on "
+getDay()+"/"+getMonth()+"/"+getYear()+" with " + getRecovery() + " minutes recovery \n";
return result;
} //getEntry

}
76 changes: 76 additions & 0 deletions SwimEntry.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.stir.cscu9t4practical1;

import java.util.Calendar;

/**
*
* @author 44752
*/
public class SwimEntry extends Entry {
private String name;
private Calendar dateAndTime;
private float distance;
private String location;
public SwimEntry (String n, int d, int m, int y, int h, int min, int s, float dist, String loc) {
super(n, d, m, y, h, min, s, dist);
location = loc;
Calendar inst = Calendar.getInstance();
inst.set(y,m-1,d,h,min,s);
distance = dist;
dateAndTime = inst;
name = n;
} //constructor
@Override
public String getName () {
return name;
} //getName
@Override
public int getDay () {
return dateAndTime.get(Calendar.DATE);
} //getDay
@Override
public int getMonth () {
int month = dateAndTime.get(Calendar.MONTH) + 1;
return month;
} //getMonth
@Override
public int getYear () {
return dateAndTime.get(Calendar.YEAR);
} //getYear
@Override
public int getHour () {
return dateAndTime.get(Calendar.HOUR);
} //getHour
@Override
public int getMin () {
return dateAndTime.get(Calendar.MINUTE);
} //getMin
@Override
public int getSec () {
return dateAndTime.get(Calendar.SECOND);
} //getSec
@Override
public float getDistance () {
return distance;
} //getYear
@Override
public String getWhere(){
return location;
}

@Override
public String getEntry () {
String result = getName()+" swam " + getDistance() + " km " + getWhere() + " in "
+getHour()+":"+getMin()+":"+ getSec() + " on "
+getDay()+"/"+getMonth()+"/"+getYear()+"\n";
return result;
} //getEntry
}



Loading