Java program used to code up interview-style functions