Splitting the LGA

Split this LGA such that:

• Each group member completes at least two questions
• When considering your group as a whole, every question is completed at least once
1. Write a function named greeting that takes a name entered as Last, First and prints the greeting:

Hello Firstname
Do you have a relative named Joe Lastname


Here is an example interaction:

GHCi> greeting
Enter your name as last, first
Luxury-Yacht, Raymond
Hello Raymond
Do you have any relatives named Joe Luxury-Yacht?

2. Write a function named sayHi. sayHi should prompt for the user’s name, and if the user enters “Bilbo” display “So nice to meet you!”. Regardless of the name, the program will display “What’s up?”:

GHCi> sayHi
So nice to meet you!
What's up?
GHCi> sayHi
What's up?


For an extra challenge, try to use Haskell’s when function in your solution (not required, you may use if/then/else if you wish).

3. First, write a function named calcAreas that accepts a list of lengths and a list of widths and returned a list of areas (hint, use zipWith):

GHCi> calcAreas [2,4,6] [8,8,8]
[16,32,48]


Using your calcAreas function, along with mapM_, to write a function named printAreas that prints the areas:

GHCi> printAreas [2,4,6] [8,8,8]
16
32
48


For an extra challenge, try to use currying (not required)!

4. First, write a function named letterDirection that takes a character representing a direction and returns the direction:

GHCi> letterDirection 'u'
"UP"
GHCi> letterDirection 'd'
"DOWN"
GHCi> letterDirection 'l'
"LEFT"
GHCi> letterDirection 'r'
"RIGHT"


You may assume that you will only receive lowercase u, d, l, and r, as shown above.

Now, write a function named printDirections that takes a list of direction characters and prints the direction to travel. Think about using forM or forM_ for this function:

GHCi> printDirections ['u','l','r','u','l']
You should go UP
You should go LEFT
You should go RIGHT
You should go UP
You should go LEFT