You’ve recently taken a job in a new city called Nashtopia. You are working on a team building an app for the sales team to better find and connect with customers. You have been tasked with filtering and sorting the customer information so that the sales team can get just the customers they need.
Code Kata Format
We’ve changed the format of the challenges to be more like a code kata. So instead of three levels of varying difficulty there will be one challenge, and a step further, that you can make as difficult as you need based on where you want to place your focus on learning.
The Challenge
Nashtopia is broken up into 7 different zones. These are represented by the first digit of the CustomerId. The sales team wants to be able to select the name of the zone and print out a list of all the customers in that zone only.
Hint: You will need to get the zone number from the list of zones then compare that to the first digit in the CustomerId.
Nashtopia Zones
Zone | Name |
---|---|
1 | Downtown |
2 | Midtown |
3 | Uptown |
4 | NoBro |
5 | The Glades |
6 | The Narrows |
7 | Bakerline |
Customer List
CustomerId | First Name | Last Name | Street Address |
---|---|---|---|
62342 | Bruce | Wayne | 13 Wayne Ln |
48323 | Bill | Preston, Esq. | 555 Excellent Dr |
19365 | Peter | Lattimer | 321 Leenas Pl |
77314 | Lex | Luthor | 99 High St |
66376 | Harvey | Dent | 22 Facelift Ave |
46923 | Ted | Logan | 283 Excellent Dr |
74056 | Clark | Kent | 187 Louis Ln |
16842 | Claudia | Donovan | 223 Brother St |
47932 | Billy | Kid | 423 Western Rd |
68234 | Alfred | Pennyworth | 12 Wayne Ln |
72034 | Jimmy | Olson | 32 Camera Dr |
15451 | Myka | Bering | 121 Leenas Pl |
Creating a Test Case
Write a test case before you start your code. Then write just enough code to pass the test. Once you have passing code refactor to pass other test cases.
Hint: The customer list provided is just a starting point to best test your code add more to the list.
A Step Further
The sales team loves that they can print out a list of just the customers in their zone. Now they’ve asked you to add a sort feature. They want to be able to sort by street address so they can have all the customers on the same street together.