Files
learngo/11-if/exercises/09/main.go
2018-10-20 21:17:19 +03:00

90 lines
2.1 KiB
Go

// For more tutorials: https://blog.learngoprogramming.com
//
// Copyright © 2018 Inanc Gumus
// Learn Go Programming Course
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
//
package main
// ---------------------------------------------------------
// EXERCISE
// Print the number of days in a given month.
//
// RESTRICTIONS
// 1. On a leap year, february should print 29. Otherwise, 28.
//
// Set your computer clock to 2020 to see whether it works.
//
// 2. It should work case-insensitive. See below.
//
// Search on Google: golang pkg strings ToLower
//
// 3. Get the current year using the time.Now()
//
// Search on Google: golang pkg time now year
//
//
// EXPECTED OUTPUT
//
// -----------------------------------------
// Your solution should not accept invalid months
// -----------------------------------------
// go run main.go
// Give me a month name
//
// go run main.go sheep
// "sheep" is not a month.
//
// go run main.go january
// "january" has 31 days.
//
// -----------------------------------------
// Your solution should handle the leap years
// -----------------------------------------
// go run main.go february
// "february" has 28 days.
//
// go run main.go march
// "march" has 31 days.
//
// go run main.go april
// "april" has 30 days.
//
// go run main.go may
// "may" has 31 days.
//
// go run main.go june
// "june" has 30 days.
//
// go run main.go july
// "july" has 31 days.
//
// go run main.go august
// "august" has 31 days.
//
// go run main.go september
// "september" has 30 days.
//
// go run main.go october
// "october" has 31 days.
//
// go run main.go november
// "november" has 30 days.
//
// go run main.go december
// "december" has 31 days.
//
// -----------------------------------------
// Your solution should be case insensitive
// -----------------------------------------
// go run main.go DECEMBER
// "DECEMBER" has 31 days.
//
// go run main.go dEcEmBeR
// "dEcEmBeR" has 31 days.
// ---------------------------------------------------------
func main() {
}