From 3c374e38dcb75d9b420a33b7134fb1bef69a9360 Mon Sep 17 00:00:00 2001 From: Inanc Gumus Date: Sat, 27 Oct 2018 17:57:50 +0300 Subject: [PATCH] add: switch statement exercises --- 12-switch/exercises/{01 => 01-richter-scale}/main.go | 3 ++- .../{01 => 01-richter-scale}/solution/main.go | 0 .../exercises/{02 => 02-richter-scale-2}/main.go | 3 ++- .../{02 => 02-richter-scale-2}/solution/main.go | 0 12-switch/exercises/{03 => 03-convert}/main.go | 3 ++- .../exercises/{03 => 03-convert}/solution/main.go | 0 .../exercises/{04 => 04-string-manipulator}/main.go | 4 +++- .../{04 => 04-string-manipulator}/solution/main.go | 0 12-switch/exercises/{05 => 05-days-in-month}/main.go | 3 ++- .../{05 => 05-days-in-month}/solution/main.go | 0 12-switch/exercises/README.md | 12 ++++++------ 11 files changed, 17 insertions(+), 11 deletions(-) rename 12-switch/exercises/{01 => 01-richter-scale}/main.go (98%) rename 12-switch/exercises/{01 => 01-richter-scale}/solution/main.go (100%) rename 12-switch/exercises/{02 => 02-richter-scale-2}/main.go (98%) rename 12-switch/exercises/{02 => 02-richter-scale-2}/solution/main.go (100%) rename 12-switch/exercises/{03 => 03-convert}/main.go (97%) rename 12-switch/exercises/{03 => 03-convert}/solution/main.go (100%) rename 12-switch/exercises/{04 => 04-string-manipulator}/main.go (96%) rename 12-switch/exercises/{04 => 04-string-manipulator}/solution/main.go (100%) rename 12-switch/exercises/{05 => 05-days-in-month}/main.go (97%) rename 12-switch/exercises/{05 => 05-days-in-month}/solution/main.go (100%) diff --git a/12-switch/exercises/01/main.go b/12-switch/exercises/01-richter-scale/main.go similarity index 98% rename from 12-switch/exercises/01/main.go rename to 12-switch/exercises/01-richter-scale/main.go index f8720d0..c097e0a 100644 --- a/12-switch/exercises/01/main.go +++ b/12-switch/exercises/01-richter-scale/main.go @@ -16,7 +16,8 @@ package main // // So, you've decided to write a program to do that for you. // -// EXERCISE +// EXERCISE: Richter Scale +// // 1. Get the earthquake magnitude from the command-line. // 2. Display its corresponding description. // diff --git a/12-switch/exercises/01/solution/main.go b/12-switch/exercises/01-richter-scale/solution/main.go similarity index 100% rename from 12-switch/exercises/01/solution/main.go rename to 12-switch/exercises/01-richter-scale/solution/main.go diff --git a/12-switch/exercises/02/main.go b/12-switch/exercises/02-richter-scale-2/main.go similarity index 98% rename from 12-switch/exercises/02/main.go rename to 12-switch/exercises/02-richter-scale-2/main.go index bd3cae1..c09549a 100644 --- a/12-switch/exercises/02/main.go +++ b/12-switch/exercises/02-richter-scale-2/main.go @@ -8,7 +8,8 @@ package main // --------------------------------------------------------- -// EXERCISE +// EXERCISE: Richter Scale #2 +// // Repeat the previous exercise. // // But, this time, get the description and print the diff --git a/12-switch/exercises/02/solution/main.go b/12-switch/exercises/02-richter-scale-2/solution/main.go similarity index 100% rename from 12-switch/exercises/02/solution/main.go rename to 12-switch/exercises/02-richter-scale-2/solution/main.go diff --git a/12-switch/exercises/03/main.go b/12-switch/exercises/03-convert/main.go similarity index 97% rename from 12-switch/exercises/03/main.go rename to 12-switch/exercises/03-convert/main.go index 0a9130a..6e942c0 100644 --- a/12-switch/exercises/03/main.go +++ b/12-switch/exercises/03-convert/main.go @@ -13,7 +13,8 @@ import ( ) // --------------------------------------------------------- -// EXERCISE +// EXERCISE: Convert +// // Convert the if statement to a switch statement. // --------------------------------------------------------- diff --git a/12-switch/exercises/03/solution/main.go b/12-switch/exercises/03-convert/solution/main.go similarity index 100% rename from 12-switch/exercises/03/solution/main.go rename to 12-switch/exercises/03-convert/solution/main.go diff --git a/12-switch/exercises/04/main.go b/12-switch/exercises/04-string-manipulator/main.go similarity index 96% rename from 12-switch/exercises/04/main.go rename to 12-switch/exercises/04-string-manipulator/main.go index 20fd758..13b38f1 100644 --- a/12-switch/exercises/04/main.go +++ b/12-switch/exercises/04-string-manipulator/main.go @@ -12,8 +12,10 @@ package main // You want to write a program that will manipulate the // given strings to uppercase, lowercase, and title case. // -// EXERCISE +// EXERCISE: String Manipulator +// // 1. Get the operation as the first argument. +// // 2. Get the string to be manipulated as the 2nd argument. // // HINT diff --git a/12-switch/exercises/04/solution/main.go b/12-switch/exercises/04-string-manipulator/solution/main.go similarity index 100% rename from 12-switch/exercises/04/solution/main.go rename to 12-switch/exercises/04-string-manipulator/solution/main.go diff --git a/12-switch/exercises/05/main.go b/12-switch/exercises/05-days-in-month/main.go similarity index 97% rename from 12-switch/exercises/05/main.go rename to 12-switch/exercises/05-days-in-month/main.go index c540f5d..8b18220 100644 --- a/12-switch/exercises/05/main.go +++ b/12-switch/exercises/05-days-in-month/main.go @@ -15,7 +15,8 @@ import ( ) // --------------------------------------------------------- -// EXERCISE +// EXERCISE: Days in a Month +// // Refactor the previous exercise from the if statement // section. // diff --git a/12-switch/exercises/05/solution/main.go b/12-switch/exercises/05-days-in-month/solution/main.go similarity index 100% rename from 12-switch/exercises/05/solution/main.go rename to 12-switch/exercises/05-days-in-month/solution/main.go diff --git a/12-switch/exercises/README.md b/12-switch/exercises/README.md index 4a7aca7..8fe792e 100644 --- a/12-switch/exercises/README.md +++ b/12-switch/exercises/README.md @@ -1,11 +1,11 @@ -# Header +# Switch Statement -What you will learn? +1. **[Richter Scale](https://github.com/inancgumus/learngo/tree/master/12-switch/exercises/01-richter-scale)** -1. **[text](https://github.com/inancgumus/learngo/tree/master/)** +2. **[Richter Scale #2](https://github.com/inancgumus/learngo/tree/master/12-switch/exercises/02-richter-scale-2)** - text +3. **[Convert](https://github.com/inancgumus/learngo/tree/master/12-switch/exercises/03-convert)** -2. **[text](https://github.com/inancgumus/learngo/tree/master/)** +4. **[String Manipulator](https://github.com/inancgumus/learngo/tree/master/12-switch/exercises/04-string-manipulator)** - text \ No newline at end of file +5. **[Days in a Month](https://github.com/inancgumus/learngo/tree/master/12-switch/exercises/05-days-in-month)**