A Algorithm Example Code For Encapsulation