Cognizant Interview Question

coding quesstion on movie ticket counter