Modify your answer to Exercise 4 so that the printing of the day name corresponding to a day number is done by a method, printDayName (int day)
.
Then change the main()
method so that if there is no command line argument it runs an automated test, looping through a range of numbers for testing your new method.
Hints:
1. To check how many command line arguments there are, test the value of args.length
2. Method printDayName ()
will need to have the modifier static
in front of it (explained later). Should the method be public or private?