Advertisement
Guest User

Untitled

a guest
Oct 26th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package hva.nl;
  7. import java.util.Scanner;
  8. /**
  9. *
  10. * @author Julius Bout
  11. */
  12. public class TentamenLeren {
  13.  
  14. public static void main(String[] args) {
  15. int[]puntenTeam1 = new int[8];
  16. int[]puntenTeam2 = new int[8];
  17. int win1 = 0;
  18. int win2 = 0;
  19.  
  20. System.out.println("Julius - Bout IB104 - 500766567");
  21. System.out.println("\n");
  22. Scanner input = new Scanner(System.in);
  23. System.out.print("Naam van team 1: ");
  24. String team1 = input.next();
  25. System.out.print("Naam van team 2: ");
  26. String team2 = input.next();
  27.  
  28.  
  29.  
  30. for (int i = 0; i < puntenTeam1.length; i++) {
  31. System.out.print("hoeveel punten hebben de " + team1 + " gemaakt?:");
  32. puntenTeam1[i] = input.nextInt();
  33. }
  34. System.out.println("\n");
  35. for (int i= 0; i< puntenTeam2.length; i++ ){
  36. System.out.print("Hoeveel punten hebben de " + team2 + " gemaakt?:");
  37. puntenTeam2 [i] = input.nextInt();
  38. }
  39.  
  40. System.out.println("\n");
  41.  
  42. int i =0;
  43.  
  44. if (puntenTeam1[i] > puntenTeam2[i]){
  45. win1++;
  46. } else {
  47. win2++;
  48. }
  49.  
  50. i++;
  51. if (win1 > 4 && win2 <4);
  52. System.out.println("Aantal gespeelde wedstrijden: " + (i-1));
  53. if (win1 >= win2){
  54. System.out.println(team1 +" Heeft gewonnen met " + win1 + "-" +
  55. win2);
  56. } else {
  57. System.out.println(team2 +" Heeft gewonnen met " + win2 + "-" +
  58. win1);
  59. }
  60. }
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement