The error is related to the absence of the method “transfer” in the “admin” address.
Simply declare “admin” as “address payable”:
address payable admin;
Starting from compiler version 0.5.0, “payable address”“address payable” type only havehas the method cited.
From Solidity documentation: