Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class CreditRequest
- def initialize(age, gender, income, credit_history, requested_amount)
- @age = age
- @gender = gender
- @income = income
- @credit_history = credit_history
- @requested_amount = requested_amount
- @scores = 0
- end
- def set_credit_score
- if @age >= 21 && @age <= 40
- @scores + 10
- elsif @age > 40 && @age <= 60
- @scores + 20
- end
- if @gender == "женщина"
- @scores + 10
- else
- @scores +0
- end
- if @income >= 20001 && @income <= 40000
- @scores + 10
- elsif @income > 40000
- @scores + 20
- end
- if @credit_history == "да"
- @scores + 20
- else
- @scores + 0
- end
- if @requested_amount <= 20000
- @scores + 20
- elsif @requested_amount >= 21000 && @requested_amount <= 40000
- @scores + 10
- end
- end
- def approve?
- @scores >= 50
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement