Task 4 of 7 · 0 solved · 7 to go0%
You can read the problem, but answers are checked only for signed-in students. Sign in to answer →

11.2 Switch expressions — days in a month

Total: 0 / 3 pts
Practice mode — check each part and get hints as you go.
Task

Fill in daysInMonth using a switch expression with a grouped label: months 4, 6, 9, 11 have 30 days, month 2 has 28, all others 31.

Several values share one branch when listed with commas. The program prints 30, 28, 31. (Ignore leap years.)

Your solution