Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. class CreditRequest
  2.  
  3. def initialize(age, gender, income, credit_history, requested_amount)
  4. @age = age
  5. @gender = gender
  6. @income = income
  7. @credit_history = credit_history
  8. @requested_amount = requested_amount
  9.  
  10. @scores = 0
  11. end
  12.  
  13. def set_credit_score
  14. if @age >= 21 && @age <= 40
  15. @scores + 10
  16. elsif @age > 40 && @age <= 60
  17. @scores + 20
  18. end
  19.  
  20. if @gender == "женщина"
  21. @scores + 10
  22. else
  23. @scores +0
  24. end
  25.  
  26. if @income >= 20001 && @income <= 40000
  27. @scores + 10
  28. elsif @income > 40000
  29. @scores + 20
  30. end
  31.  
  32. if @credit_history == "да"
  33. @scores + 20
  34. else
  35. @scores + 0
  36. end
  37.  
  38. if @requested_amount <= 20000
  39. @scores + 20
  40. elsif @requested_amount >= 21000 && @requested_amount <= 40000
  41. @scores + 10
  42. end
  43. end
  44.  
  45. def approve?
  46. @scores >= 50
  47. end
  48.  
  49. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement