Advertisement
Guest User

Untitled

a guest
Mar 24th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. package yoav24mar;
  2.  
  3. import java.util.Arrays;
  4. import java.util.Scanner;
  5.  
  6. public class reain {
  7.  
  8. public static Scanner in = new Scanner(System.in);
  9. public boolean isInGroup(Student st, Student[] group){
  10. for(int i = 0; i<group.length; i++){
  11. if(group[i].equals(st)) return true;
  12. }
  13. return false;
  14. }
  15.  
  16. public static int gradeSt(int[] ans){
  17. int temp = 0;
  18. int score = 0;
  19. for(int i = 0; i<ans.length; i++){
  20. temp = (int)(Math.random()*4)+1;
  21. if(temp == ans[i]){
  22. score = score + 5;
  23. }
  24. }
  25. return score;
  26. }
  27.  
  28. public static void Update(Student[] group, int[] ans){
  29. int tscore = 0;
  30. for(int i = 0; i<group.length;i++){
  31. tscore = gradeSt(ans);
  32. Student tret = new Student("Adolf", tscore);
  33. group[i] = tret;
  34. }
  35. }
  36.  
  37. public static void main(String[] args) {
  38.  
  39. Student stue = new Student("Danny",5);
  40.  
  41. stue.setGrade(0);
  42. System.out.println(stue.toString());
  43.  
  44. Student[] stGroup = new Student[10];
  45.  
  46. for(int i = 1; i < stGroup.length; i++){
  47. stGroup[i] = new Student("Adolf",0);
  48. }
  49.  
  50. int[] answers = new int[20];
  51. for(int i = 0; i<answers.length; i++){
  52. answers[i] = (int)(Math.random()*4)+1;
  53. }
  54.  
  55. Update(stGroup, answers);
  56. for(int i = 0; i < stGroup.length; i++){
  57. System.out.println(stGroup[i].toString());
  58. }
  59.  
  60.  
  61.  
  62. }
  63.  
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement