Need help with this Java code, please include commenting so I can understand the code.
Write the static method seconds() returning an int value for the number of seconds based on the parameters (see calls below): seconds(int hour), seconds(int hour, int minutes), and seconds(int hour, int minutes, int seconds).
Notes: Recall overloading (polymorphism) to implement methods with the same name: seconds(), but different parameters.
Include the method in a tester application, SecondsTester, and make the direct calls to the method shown below.
You can check your testing against: http://www.csgnetwork.com/directcvthrminsec2sechtml
There is no requirement for user input; so hard-code all the test calls to the method in the main(), as with these examples:
int sec = 0; // store the number of calculated seconds
sec = seconds(2);
System.out.println(sec);
// one param means "hours to seconds" (note: hr * 60 * 60) sec/hr = 7200 seconds
sec = seconds(1, -14);
System.out.println(sec);
// two params means hours and minutes (hr, 14 min) (note: hr * 60 * 60) sec/hr + 14 min * 60 sec/min = 4440 seconds
sec = seconds(1, 10, 5);
System.out.println(sec);
// three params means hours, minutes, and seconds (hr, 10 min, sec) (note: 1 hr * 60 * 60 sec/hr + 10 min * 60 sec/min + sec = 4205 seconds
sec = seconds(0, 2, 0);
System.out.println(sec);
// three params means hours, minutes, and seconds (hr, min, sec) (note: 0 hr * 60 * 60 sec/hr + 2 min * 60 sec/min + sec = 120 seconds
sec = seconds(0, 0, 0);
System.out.println(sec);
// three params means hours, minutes, and seconds (hr, min, sec) (note: 0 hr * 60 * 60 sec/hr + 0 min * 60 sec/min + sec = 0 seconds
sec = seconds(0, 0);
System.out.println(sec);
// two params means hours and minutes (hr, min) (note: 0 hr * 60 * 60 sec/hr + 0 min * 60 sec/min = 0 seconds
sec = seconds(0);
System.out.println(sec);
// one param means "hours to seconds" (note: hr * 60 * 60) sec/hr = 0 seconds