Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 or to the month according to its name.
If the month name is January, save as the month number.
else If the month name is February, save as the month number.
else If the month name is March, save as the month number.
else If the month name is April, save as the month number.
else If the month name is May, save as the month number.
else If the month name is June, save as the month number.
else If the month name is July, save as the month number.
else If the month name is August, save as the month number.
else If the month name is September, save as the month number.
else If the month name is October, save as the month number.
else If the month name is November, save as the month number.
else If the month name is December, save as the month number.
else the month is invalid, save as the month number.
Output:
Display the month name January to December or invalid and its ordinal number st to th
or invalid according to its month number:
Case : The month is January, display January as the st month.
Case : The month is February, display February as the nd month.
Case : The month is March, display March as the rd month.
Case : The month is April, display April as the th month.
Case : The month is May, display May as the th month.
Case : The month is June, display June as the th month.
Case : The month is July, display July as the th month.
Case : The month is August, display August as the th month.
Case : The month is September, display September as the th month.
Case : The month is October, display October as the th month.
Case : The month is November, display November as the th month.
Case : The month is December, display December as the th month.
Case : 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started