2.b. Write a program to declare and initialize an array of 12 strings and initialize them to the months of the year. Add code to output them to the console in a column. January February March … 2.c....

2.b. Write a program to declare and initialize an array of 12 strings and initialize them to the months of the year. Add code to output them to the console in a column. January February March … 2.c. Add an array for the number of days in each month (ignore leap years), and have your program print the month and the number of days in the month. January 31 February 28 March 31 … 2.d. Now let’s add a third array to keep track of how many days there are before the beginning of each month. (i.e., 0 for January, 31 for February, 59 for March, 90 for April, etc.). You could calculate those by hand, but instead, use a loop, to fill it with the number-of-days preceding each month. (It might help to do it by hand first, so you know what the steps you need to go through are…). Now, have your program print out a table with the month, the number of days in the month, and the number of days preceding the month. For example: Month days days preceding _________ __ __ January 31 0 February 28 31 March 31 59\ ... 2.e Now, let’s see if we can use these arrays. Add code to prompt the user for a day of the year. ( Given the day of the year, print the day's month and day-of-month. For example, day 24 should produce January 24, day 35 should produce February 4, and day 364 should produce December 30
Nov 19, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here