This offers a nice option for students to practice identifying components of a hypothesis test. I would use the p-value approach rather than the rejection region approach. A link is provided to have you switch to the p-value method.
I don't like using "r" to count the number of successes. This is very confusing and some students might mistake this for the coorelation coefficent.