Solution: Arrays
Let's discuss the solution to the exercise.
We'll cover the following
Problem
In this exercise, an array stores months that are retrieved later. Write code for a console based Months app that meets the requirements listed below.
- If
userResponse
is a number from1
–12
, display the month, like the following:
2 is February
- If
userResponse
containsDisplay All
, display all months from the array on the console, like the following:
January
February
March
April
May
June
July
August
September
October
November
December
- If incorrect information is entered in
userResponse
, display a message saying,
Not a valid input
Get hands-on with 1400+ tech skills courses.