Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- *
- * @author sused
- */
- public class Urna {
- private final String moznosti[] = {" Moznost 1","Moznost 2","Moznost 3"};
- private int hlasy[];
- public Urna() {
- hlasy = new int[moznosti.length];
- for (int i = 0; i < hlasy.length; i++)
- hlasy[i] = 0;
- }
- public void zahlasuj(int i) {
- hlasy[i]++;
- }
- public int getHlasy(int i) {
- return hlasy[i];
- }
- public int getPocet() {
- return moznosti.length;
- }
- public String getNazov(int i) {
- return moznosti[i];
- }
- public String getVysledok() {
- String s = "";
- for (int i = 0; i < hlasy.length; i++)
- s = s + moznosti[i] + ": " + hlasy[i] + "\n ";
- return s;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement