An intermediate level task for practicing string parsing and data conversion.
LV (multinational corporation specializing in luxury goods) handbags have "date codes" with information about a handbag manufacturing location and date. In the task you have to implement "date code" generation and parsing algorithms for different "date code" formats.
Read more about LV's "date codes" before starting work on the task (Wayback Machine's copy).
- Open a project from your remote repository or get your local copy with Visual Studio.
The first group of overloaded methods should generate a "date code" string using a two-letter factory location code, a manufacturing year and a manufacturing month. The methods are overloaded. The one method should be implemented with "uint" parameters type, the second method should have "DateTime" parameter type.
- Implement the GenerateEarly1980Code(uint, uint) and GenerateEarly1980Code(DateTime) methods in the DateCodeGenerator.cs file.
- Implement the GenerateLate1980Code(string, uint, uint) and GenerateLate1980Code(DateTime) methods in the DateCodeGenerator.cs file.
- Implement the Generate1990Code(string, uint, uint) and Generate1990Code(DateTime) methods in the DateCodeGenerator.cs file.
- Implement the Generate2007Code(string, uint, uint) and Generate2007Code(DateTime) method in the DateCodeGenerator.cs file.
ISO-8601: Use EpochConverter for visualizing week numbers (see week number for 1st Jan for 2016 year). It is worth noting that Epoch Converter works according to the ISO-8601 standard, which applies special rules for calculating days, weeks and years.
Then, implement a helper method that should return a list of countries that have factories with specified factory location code. Two or more countries may have factories with the same location code (for example, France and USA have a factory with the "SD" location code). Countries are implemented as enumeration type values.
- Implement the GetCountry method in the CountryParser.cs file.
The next group of methods should parse a "date code" string and return the manufacturing data in out parameters.
- Implement the ParseEarly1980Code method in the DateCodeParser.cs file.
- Implement the ParseLate1980Code method in the DateCodeParser.cs file.
- Implement the Parse1990Code method in the DateCodeParser.cs file.
- Implement the Parse2007Code method in the DateCodeParser.cs file.
Check out the section "See also" for the methods and classes you may use to solve the task.
Additional style and code checks are enabled for the projects in this solution to help you maintaining consistency of the project source code and avoiding silly mistakes. Review the Error List in Visual Studio to see all compiler warnings and errors.
If a compiler error or warning message is not clear, review errors details or google the error or warning code to get more information about the issue.
- Rebuild your solution in Visual Studio.
- Check out the Error List window for compiler errors and warnings. If you have any of those issues, fix the issues and rebuild the solution again.
- Run all unit tests with Test Explorer and make sure there are no failed unit tests. Fix your code to make all your unit tests GREEN.
- Review all your changes before saving your work.
- Open "Changes" view in Team Explorer.
- Right click on a modified file.
- Click on "Compare with Unmodified" menu item to open a comparison window.
- Stage your changes and create a commit.
- Share your changes by pushing them to remote repository.
- Tutorials
- .NET Guide
- C# Reference
- .NET API