I have been asked to find the probability that a student passes the exam (which he does if the score is 55 ≤ X ≤ 100) and have been given a density function (see pic:

I have defined my limits and integrated over the density function which can be seen in the following code chunk in R
f1 <- function(x){
-(x/100)+(4*0.5/5)+(1/5)
}
integrate(f1,(80*p-25),(80*p+20))
I have inserted 0.5 instead of p when I define f1. I get the answer 27,76% if the student has not prepared very well (p=0.5)
I am doubting if this is done correctly, I have only used the second expression of f(x) without regards to the first, and when I type in the solution in an online integral calculator, I get a much lower value. Also, I'm not sure if the expressions of the limits, a and b, are defined correctly. I guess I would like to know how to derive the probability from a density function that has multiple expressions and what to do with those limits.
