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.

  1. If userResponse is a number from 112, display the month, like the following:
2 is February
  1. If userResponse contains Display 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
  1. If incorrect information is entered in userResponse, display a message saying,
Not a valid input

Get hands-on with 1400+ tech skills courses.