Advertisement
Guest User

Untitled

a guest
Oct 9th, 2015
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. package heittoMekansimi;
  2.  
  3. public class Laskuri {
  4.  
  5. // annetaan alkuarvoja
  6. private int laskurinArvo;
  7. private int alkuarvo = 0;
  8.  
  9.  
  10. // tehdään konstruktori
  11. public Laskuri() {
  12. this.laskurinArvo = alkuarvo;
  13.  
  14. }
  15.  
  16. // lasketaan pisteitä yhteen
  17. public void lisaa(int luku) {
  18. this.laskurinArvo = luku + laskurinArvo;
  19. }
  20.  
  21. //palautetaan pisteiden yhteinen arvo
  22. public int arvo() {
  23. return this.laskurinArvo;
  24. }
  25.  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement