Track Seasons Based on Birthdays
Single File Programming Question
Problem Statement
Fiji, a nature enthusiast, is fascinated by the changing seasons and wants to create a program to track the seasons based on birthdays. He wants a program that takes input in the form of a birthday serializes the data, and then deserializes it to determine the corresponding season.
Design a program to create an object of the Birthday class with the provided month and day. Serialize the created object to a file named birthdays.ser. Deserialize the Birthday object from the birthdays.ser file. Display the corresponding season(s) determined by the program after deserialization.
Note:
"Winter" for months 12, 1, and 2. "Spring" for months 3, 4, and 5. "Summer" for months 6, 7, and 8. "Fall" for months 9, 10, and 11. "Invalid month" for any month outside the valid range of 1 to 12.
Input:
format :The input consists of a string containing the month and day of a birthday, separated by space.
Output:
format :The output displays the corresponding season("Winter", "Spring", "Summer", "Fall") after deserialization.
If month is invalid, print "Invalid month".
Refer to the sample output for the formatting specifications.
Code constraints : The string contains numbers separated by space with at most 5 characters.
Sample test cases :
Input 1:
12 15
Output 1 :
Winter
Input 2 :
4 21
Output 2 :
Spring
Input 3 :
6 5
Output 3 :
Summer
Input 4 :
10 18
Output 4 :
Fall
Input 5 :
13 20
Output 5 :
Invalid month