Assignment 2 Introduction to Programming in Java Solution