Skip to content
Snippets Groups Projects
Commit 19292a85 authored by Atte Arjovuo's avatar Atte Arjovuo
Browse files

Add new file

parent ee8c6719
No related branches found
No related tags found
No related merge requests found
Laiva 0 → 100644
public class Laiva {
public static void main(String[] args) {
// nimi, pituus, syväys, nopeus solmuina
// metodi jossa lasketaan kuinka nopeasti laiva kulkee annetun matkan
public String nimi = "";
public double syväys = 0;
public double pituus = 0;
public double nopeus = 0; //solmuina
}
public static double kuinkaNopeasti(double aika, double matka) {
double nopeus = (matka / aika) * 1,852;
return(nopeus);
}
public Laiva(String nimi, double pituus, double syväys, double nopeus){
this.nimi = nimi;
this.pituus = pituus;
this.syväys = syväys;
this.nopeus = nopeus;
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment