Advertisement
Guest User

oefentoets

a guest
Jan 22nd, 2020
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. package nl.hva.Bestof7;
  2.  
  3. import java.util.Scanner;
  4.  
  5. /**
  6. * Naam: Kyle Duttenhofer
  7. * klas: IS103
  8. * studentnummer: 500834237
  9. */
  10.  
  11. public class Main {
  12.  
  13. public static void main(String[] args) {
  14. final int AANTAL_WEDSTRIJDEN = 7;
  15. final int MAX_GEWONNEN = 4;
  16. int punten1[] = new int[AANTAL_WEDSTRIJDEN];
  17. int punten2[] = new int[AANTAL_WEDSTRIJDEN];
  18. int win1 = 0;
  19. int win2 = 0;
  20.  
  21. Scanner scanner = new Scanner(System.in);
  22. System.out.println("Naam van team 1: ");
  23. String team1 = scanner.nextLine();
  24.  
  25. System.out.println("Naam van team 2: ");
  26. String team2 = scanner.nextLine();
  27.  
  28. while (win1 < MAX_GEWONNEN || win2 < MAX_GEWONNEN) {
  29. for (int i = 0; i < AANTAL_WEDSTRIJDEN; i++) {
  30. System.out.print("Aantal punten " + team1 + ": ");
  31. punten1[i] = scanner.nextInt();
  32.  
  33. System.out.print("Aantal punten " + team2 + ": ");
  34. punten2[i] = scanner.nextInt();
  35.  
  36. if (punten1[i] > punten2[i]) {
  37. win1++;
  38. System.out.println(team1 + " heeft gewonnen");
  39. } else {
  40. win2++;
  41. System.out.println(team2 + " heeft gewonnen");
  42. }
  43. }
  44. }
  45. }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement