Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package kolokwium.sport;
- /**
- *
- * @author Robert
- */
- public class Biegi extends Sport {
- Double dystans;
- String jednostka;
- public double odczyt_dystans(double dystans) {
- this.dystans = dystans;
- return dystans;
- }
- Biegi(double dystans) {
- super("Biegi", "Indywidualne");
- this.dystans=dystans;
- }
- Biegi(double dystans, String jednostka) {
- super("Biegi", "Indywidualne");
- this.dystans=dystans;
- this.jednostka=jednostka;
- }
- public Double getDystans() {
- return dystans;
- }
- public String getJednostka() {
- return jednostka;
- }
- public String toString (double dystans, String jednostka, String typSportu, String nazwaDyscypliny){
- String tekst="";
- if(jednostka.equals("km"))
- {
- tekst = "Sport o nazwie:"+this.nazwaDyscypliny+"type: "+this.typSportu+(String.format("%.3f", dystans))+jednostka;
- }
- if(jednostka.equals("m"))
- {
- tekst = "Sport o nazwie:"+this.nazwaDyscypliny+"type: "+this.typSportu+ dystans+jednostka;
- }
- return tekst;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement