Guest User

Untitled

a guest
May 21st, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. public class VS {
  2.  
  3. public static void main(String[] args) {
  4. int povp = 0;
  5. int[] stevila = new int[30];
  6. for (int j = 0; j < 30; j++) {
  7. boolean[] karte = new boolean[52];
  8. int count = 0;
  9. boolean all = true;
  10. while (all) {
  11. karte[(int) (Math.random() * 52)] = true;
  12. all = false;
  13. for (int i = 0; i < 52; i++) {
  14. if (!karte[i]) {
  15. all = true;
  16. break;
  17. }
  18. }
  19. count++;
  20. }
  21. System.out.print(count);
  22. if (j != 29) {
  23. System.out.print(", ");
  24. }
  25. povp += count;
  26. stevila[j] = count;
  27. }
  28. System.out.println();
  29. povp = Math.round(povp/30);
  30. System.out.println("Povprecje: " + povp);
  31. int sest = 0;
  32. for (int i = 0; i < 30; i++) {
  33. sest += Math.pow(stevila[i]-povp,2);
  34. }
  35. double nov = Math.round(Math.sqrt(sest/29));
  36. System.out.println("Ocena odklona: " + nov);
  37. nov = (1.96*nov)/Math.sqrt(30);
  38. System.out.println("Delta: " + nov);
  39. System.out.println("spodnja: " + (Math.round((povp - nov)*100))/100.);
  40. System.out.println("zgornja: " + (Math.round((povp + nov)*100))/100.);
  41. }
  42. }
Add Comment
Please, Sign In to add comment