Ohm Calculator Coding Example
This was a coding example completed for a job interview process, which I posted up here for others to take a look at. It’s very simple and uses the following technologies:
- Visual Studio 2017 Enterprise
- C#
- Command console project
- .Net Core 2
Coding Sample Requirements
- The electronic color code on Wikipedia is used to indicate the values or ratings of electronic components, very commonly for resistors. Write a class that implements the following interface. Feel free to include any supporting types as necessary.
public interface IOhmValueCalculator
{
/// <summary>
/// Calculates the Ohm value of a resistor based on the band colors.
/// </summary>
/// <param name="bandAColor">The color of the first figure of component value band.</param>
/// <param name="bandBColor">The color of the second significant figure band.</param>
/// <param name="bandCColor">The color of the decimal multiplier band.</param>
/// <param name="bandDColor">The color of the tolerance value band.</param>
int CalculateOhmValue(string bandAColor, string bandBColor, string bandCColor, string bandDColor);
}
-
Using your favorite unit test framework, write the unit tests you feel are necessary to adequately test the code you wrote as your answer to question one.
-
Create a user interface (console or web or GUI) that will allow someone to use the calculator you created in question one.