write a java program of two below questions 1

I will be attaching the questions screen shot below, do take a look.

You are supposed to write a java program for the following questions. For every question, do provide at least Three(3) different test cases.

You will have to refer back to the previous assignment that you have sent me and modify it.

You can write all the program in the microsoft word Thank you 🙂