Skip to content
Snippets Groups Projects
Commit 9398fafb authored by Jaani Söderström's avatar Jaani Söderström
Browse files

Upload New File

parent 4164b360
No related branches found
No related tags found
No related merge requests found
public class Laskukone {
int tulos;
int luku;
int muisti;
public Laskukone() {
nollaa();
}
public void lisaaLuku(int luku) {
tulos += luku;
}
public void vahennaLuku(int luku) {
tulos -= luku;
}
public void kerroLuvulla(int luku) {
tulos = tulos * luku;
}
public void korotaPotenssiin(int luku) {
muisti = tulos;
for (int i=1; i<=luku; i++) {
tulos = tulos*muisti;
}
}
public int annaTulos() {
return tulos;
}
public void nollaa() {
tulos = 0;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment