Use parallel arrays and use simple puedocode 13 a Design an

Use parallel arrays and use simple puedocode
13. a. Design an application in which the number of days for each month in the year is stored in an array. (For example, January has 31 days, February has 28, and so on. me that the year is not a leap year) Display 12 sentences in same format for the each month; for example, the sentence displayed for January is Month 1 has 31 days b. Modify the months and days program to contain a parallel array that stores month names. Display 12 sentences in the same format; for example, the first sentence is Ianuary has 31 days.

Solution

Answer A:-

pseudocode:-

Display “January is Month 1 has” day [0] “days”

Display “February is Month 2 has” day [1] “days”

Display “March is Month 3 has” day [2] “days”

Display “April is Month 4 has” day [3] “days”

Display “May is Month 5 has” day [4] “days”

Display “June is Month 6 has” day [5] “days”

Display “July is Month 7 has” day [6] “days”

Display “August is Month 8 has” day [7] “days”

Display “September is Month 9 has” day [8] “days”

Display “October is Month 10 has” day [9] “days”

Display “November is Month 11 has” day [10] “days”

Display “December is Month 12 has” day [11] “days”

-----------------------------------------------------------------------------------------------------

Answer B

pseudocode is:-

// using parallel array

For i=0 to 12 do

        Display      monthName[] “has” day[0] “days”

End of For loop

---------------------------------------------------------------------------------------------

If you have any query, please feel free to ask.

Thanks a lot.

Use parallel arrays and use simple puedocode 13. a. Design an application in which the number of days for each month in the year is stored in an array. (For exa

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site