Question: in java, Convert a month name into a month name in title case and an ordinal number. Input: Read a month name. Process: Break the

in java, Convert a month name into a month name in title case and an ordinal number.
Input:
Read a month name.
Process:
Break the month name into two parts: first character and the remaining characters.
Convert the first part to uppercase.
Convert the second part to lowercase.
Combine the two converted parts into one and save it as the month name.
Assign a month number (1-12) or -1 to the month according to its name.
If the month name is January, save 1 as the month number.
else If the month name is February, save 2 as the month number.
else If the month name is March, save 3 as the month number.
else If the month name is April, save 4 as the month number.
else If the month name is May, save 5 as the month number.
else If the month name is June, save 6 as the month number.
else If the month name is July, save 7 as the month number.
else If the month name is August, save 8 as the month number.
else If the month name is September, save 9 as the month number.
else If the month name is October, save 10 as the month number.
else If the month name is November, save 11 as the month number.
else If the month name is December, save 12 as the month number.
else the month is invalid, save -1 as the month number.
Output:
Display the month name (January to December) or invalid and its ordinal number (1 st to 12 th)
or invalid according to its month number:
Case 1: The month is January, display January as the 1 st month.
Case 2: The month is February, display February as the 2 nd month.
Case 3: The month is March, display March as the 3 rd month.
Case 4: The month is April, display April as the 4 th month.
Case 5: The month is May, display May as the 5 th month.
Case 6: The month is June, display June as the 6 th month.
Case 7: The month is July, display July as the 7 th month.
Case 8: The month is August, display August as the 8 th month.
Case 9: The month is September, display September as the 9 th month.
Case 10: The month is October, display October as the 10 th month.
Case 11: The month is November, display November as the 11 th month.
Case 12: The month is December, display December as the 12 th month.
Case -1: The month is invalid, display invalid as an invalid month. Assign a month number:
o You must use if -else if- else statement for this part.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!