Advertisement
Dakufuren

Untitled

Sep 30th, 2014
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 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.  
  7. package s2t4;
  8.  
  9. import java.util.Scanner;
  10.  
  11. /**
  12. *
  13. * @author AlbinSkola
  14. */
  15. public class S2T4 {
  16.  
  17.  
  18. /**
  19. * @param args the command line arguments
  20. */
  21. public static void main(String[] args) {
  22. int betyg = 0;
  23.  
  24. S2T4 call = new S2T4();
  25.  
  26. Scanner scanner = new Scanner(System.in);
  27.  
  28. System.out.println("Skriv hur många betyg det finns:");
  29. betyg = scanner.nextInt();
  30.  
  31. call.GetEachBetyg(betyg);
  32.  
  33. }
  34.  
  35. public int GetEachBetyg (int betyg) {
  36. int gu = 0;
  37. int g3 = 0;
  38. int g4 = 0;
  39. int g5 = 0;
  40. int betygin;
  41.  
  42. Scanner scanner = new Scanner(System.in);
  43.  
  44. for (int i = 0; i < betyg; i++) {
  45. System.out.println("Skriv in dina betyg:");
  46. betygin = scanner.nextInt();
  47.  
  48. if (betygin <= 19) {
  49. gu++;
  50. System.out.println("1+ U (FAIL)");
  51. }
  52.  
  53. else if (betygin <= 29) {
  54. g3++;
  55. }
  56.  
  57. else if (betygin <= 35) {
  58. g4++;
  59. }
  60.  
  61. else if (betygin <= 40) {
  62. g5++;
  63. }
  64. }
  65.  
  66. System.out.println("U Fail:" + gu);
  67. System.out.println("20-29p:" + g3);
  68. System.out.println("30-35p:" + g4);
  69. System.out.println("36-40p:" + g5);
  70.  
  71. return betyg;
  72. }
  73.  
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement