Advertisement
joxaren

Dima's Teacher

Mar 29th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.64 KB | None | 0 0
  1. import java.util.Random;
  2.  
  3. /**
  4.  * Created by DarkCasual on 30.03.2017.
  5.  */
  6. public class Teacher {
  7.     final static String[] resultIs5 = {" Keep up the good work!", " You should go to MIT with results like these!",
  8.             " I wish you were my child!", "Come here and let me give you a kiss!"};
  9.     final static String[] resultIs3or4 = {" You could have done better, you know. I'm going to inform your parents of your performance.",
  10.             " I am not happy with your performance.", " You should consider a career in floor sweeping."};
  11.     final static String[] resultIs2 = {" Get outta here, you fuckwit!", " You should be ashamed of yourself!",
  12.             " You deserve some corporeal punishment, go fetch the belt."};
  13.  
  14.  
  15.     void commentingOnResults(Student[] students) {
  16.         Random random = new Random();
  17.         System.out.println("Attention, students! Here are your exam results, listen closely.");
  18.         for (Student student : students) {
  19.             int currentStudentMark = student.mark;
  20.  
  21.             System.out.print(student.name + ", group " + student.group + ", your result is " + currentStudentMark + ".");
  22.             if (currentStudentMark == 5) {
  23.                 System.out.println(" " + resultIs5[random.nextInt(resultIs5.length)]);
  24.             }
  25.             if (currentStudentMark >= 3) {
  26.                 System.out.println(" " + resultIs3or4[random.nextInt(resultIs3or4.length)]);
  27.             }
  28.             if (currentStudentMark < 3) {
  29.                 System.out.println(" " + resultIs2[random.nextInt(resultIs2.length)]);
  30.             }
  31.         }
  32.         System.out.println("Class dismissed, everybody out!");
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement