Write a program that determines the number of days in a given semester. Input to the program is the year, month, and day information of the first and the last days of a semester. Hint: Create GregorianCalendar objects for the start and end dates of a semester and manipulate their DAY_OF_YEAR data.
Program Plan:
- Import the util package that contains Scanner and Gregoriancalendar classes.
- The Scanner class object reads console input entered by the user. The Gregoriancalendar class object stores the values of starting and ending dates of the semester.
- Define main class MainClass and initialize main () function.
- Declare integer variables and objects of Scanner and Gregoriancalendar classes.
- The object lineSeparator uses the getproperty () method to read for a new line.
- Prompt user to enter start and end dates of the semester.
- Calculate the number of days in the semester.
- Use method println() of System class to display the results.