T
T
Terroris3372020-08-29 11:26:30
PHP
Terroris337, 2020-08-29 11:26:30

How to implement a task in OOP?

There is a task:
Two teams, A and B, are playing football. Someone makes a bet on the result of the match, for example, 1:2.
According to the result of the match, the real score becomes known, and we need to give out one or another prize. If someone guessed the exact score, he gets a big prize. If someone guessed the outcome of the match (winning one or another team, or a draw) - he receives a small prize. If he did not guess correctly, he receives a zero prize.
It is necessary to write a function that takes the expected and real scores as arguments, and returns an integer 0, 1 or 2 (zero, small or big prize).

Tell me how to do it in OOP, how to do it better, the very essence.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
m1rvi, 2020-08-29
@Terroris337

$points = //здесь счет
//сюда суй все что нужно;
$user_points = //что предсказал пользователь;

if( $points == $user_points) {
//здесь если юзер точно предсказал 
}
if( ! $points == $user_points) {
//здесь если юзер не предсказал
}

What's the catch ?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question