Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package s2t4;
- import java.util.Scanner;
- /**
- *
- * @author AlbinSkola
- */
- public class S2T4 {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- int betyg = 0;
- S2T4 call = new S2T4();
- Scanner scanner = new Scanner(System.in);
- System.out.println("Skriv hur många betyg det finns:");
- betyg = scanner.nextInt();
- call.GetEachBetyg(betyg);
- }
- public int GetEachBetyg (int betyg) {
- int gu = 0;
- int g3 = 0;
- int g4 = 0;
- int g5 = 0;
- int betygin;
- Scanner scanner = new Scanner(System.in);
- for (int i = 0; i < betyg; i++) {
- System.out.println("Skriv in dina betyg:");
- betygin = scanner.nextInt();
- if (betygin <= 19) {
- gu++;
- System.out.println("1+ U (FAIL)");
- }
- else if (betygin <= 29) {
- g3++;
- }
- else if (betygin <= 35) {
- g4++;
- }
- else if (betygin <= 40) {
- g5++;
- }
- }
- System.out.println("U Fail:" + gu);
- System.out.println("20-29p:" + g3);
- System.out.println("30-35p:" + g4);
- System.out.println("36-40p:" + g5);
- return betyg;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement