Write a Coral program that takes a date as input and outputs the date's season. The input is an integer to represent the month and an integer to represent the day. Ex: If the input is: 4 11 the output is: spring In addition, check if both integers are valid (an actual month and day). Ex: If the input is: 14 65 the output is: invalid The dates for each season are: spring: March 20 - June 20 summer: June 21 - September 21 autumn: September 22 - December 20 winter: December 21 - March 19

Respuesta :

Using the computational language in Coral we have that it will be possible to classify the seasons of the year through the dates of days and months.

Writing the code in Coral we have:

integer month

integer day

month = Get next input

day = Get next input

if month == 1 and day > 0 and day < 32

  Put "winter" to output

 elseif month == 2 and day > 0 and day < 30

  Put "winter" to output

elseif month == 3 and day > 0 and day < 32

  if day < 20

     Put "winter" to output

  else

     Put "spring" to output

elseif month == 4 and day > 0 and day < 31

  Put "spring" to output

elseif month == 5 and day > 0 and day < 32

  Put "spring" to output

elseif month == 6 and day > 0 and day < 31

  if day < 21

     Put "spring" to output

  else

     Put "summer" to output

elseif month == 7 and day > 0 and day < 32

  Put "summer" to output

elseif month == 8 and day > 0 and day < 32

  Put "summer" to output

elseif month == 9 and day > 0 and day < 31

  if day < 22

     Put "summer" to output

  else

     Put "autumn" to output

elseif month == 10 and day > 0 and day < 32

  Put "autumn" to output

elseif month == 11 and day > 0 and day < 31

  Put "autumn" to output

elseif month == 12 and day > 0 and day < 32

  if day < 21

     Put "autumn" to output

  else

     Put "winter" to output

else

  Put "invalid" to output

See more about Coral at brainly.com/question/18502436

#SPJ1

Ver imagen lhmarianateixeira
ACCESS MORE