The program below is the solution to Liang’s Introduction to Java (9th Edition) Chapter 3 Exercise 3.3.

Program sample runClick here…