Guest User

Untitled

a guest
Apr 24th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. package exam;
  2.  
  3. import java.io.PrintWriter;
  4. import java.util.Scanner;
  5.  
  6. public class ScoreLine {
  7.  
  8. private final static double PASSED_RATIO = 0.6;
  9. public String name;
  10. public int score;
  11.  
  12. public ScoreLine() {
  13. enterData();
  14. }
  15.  
  16. public ScoreLine(Scanner scan) {
  17. readData(scan);
  18. }
  19.  
  20. public String genLine() {
  21. return name + " " + score;
  22.  
  23. }
  24.  
  25. public void readData(Scanner scan){
  26. name = scan.next();
  27. score = scan.nextInt();
  28. }
  29.  
  30. public void enterData() {
  31. name = UserInput.getString("podaj login:");
  32. score = UserInput.getInt("podaj wynik:");
  33. }
  34.  
  35. public boolean isPassed(int max) {
  36. int min = (int) Math.floor(max * PASSED_RATIO);
  37. return score > min;
  38. }
  39.  
  40. public void writeData(PrintWriter out) {
  41. out.println(genLine());
  42. }
  43. }
Add Comment
Please, Sign In to add comment