Formulating exam score problem

22 Views Asked by At

There are $5$ questions: $4$ main questions and $1$ quiz question. $4$ main questions has score $20,\,30,\,30,\,20$ (The sum is $100$). $1$ quiz question equals $50$ points to help the main score. But, the sum of these $5$ questions must not exceed $100$.

The quiz question is optional to work with, but the $4$ questions must be done.

Example of cases:

  1. If the student answers $4$ main questions correctly they get $100$.
  2. If the student answers $4$ main questions and $1$ quiz question correctly they get $100$.
  3. If the student answers $4$ main questions $(20+20+20+20=80)$ they get $80$
  4. If the student answers $4$ main questions $(20+20+20+20=80)$ and $1$ quiz question $(50)$ they get $100$.
  5. If the student answers $4$ main questions $(5+10+5+5=25)$ and $1$ quiz question $(50)$ they get $75$.

Attempt:

$$\begin{align} \text{S}=\frac{A}{150}\times 100\\ S&=\text{Score}\\ A&=\text{All possible score} \end{align}$$

But that formula only applies if the student answer the quiz question. How to formulate the score, so with or without answering quiz question the formula holds?

1

There are 1 best solutions below

0
On BEST ANSWER

I'm assuming you want a function that caps the score at 100. There's a perfect function for this: $S = \min(A, 100)$.

If $A \leq 100$, this will return the value of $A$, but if the score goes over 100 ($A>100$), then it will return 100.