-
Notifications
You must be signed in to change notification settings - Fork 1
Feature/update assessment instructions #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,84 +1,75 @@ | ||||||||||||||||||||||||||
| # Gross-to-net Pay Check Coding Challenge | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| Requirements: | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| - Calculate the net pay as follows: net pay = taxable earnings - pre-tax deductions - taxes - post-tax deductions + non-taxable earnings | ||||||||||||||||||||||||||
| - Earning types | ||||||||||||||||||||||||||
| - Salary earnings are defined by a flat `amount` | ||||||||||||||||||||||||||
| - Hourly earnings are defined by an amount of `hours` and a `rate` | ||||||||||||||||||||||||||
| - Earnings that are not taxable are not withheld by deductions or taxes | ||||||||||||||||||||||||||
| - Pre-tax deductions are based on gross taxable-pay | ||||||||||||||||||||||||||
| - Flat vs percentage deductions (percentages encoded as `value / 100`) | ||||||||||||||||||||||||||
| - Taxes are based on gross taxable-pay less pre-tax deductions | ||||||||||||||||||||||||||
| - Taxes with a cap should not be withheld above the cap | ||||||||||||||||||||||||||
| - Post-tax deductions are based on gross taxable-pay less pre-tax deductions and taxes | ||||||||||||||||||||||||||
| - Deduction and tax priority | ||||||||||||||||||||||||||
| - When taxable earnings are less than deductions and taxes, withholding priority is as follows: pre-tax deductions before taxes before post-tax deductions. | ||||||||||||||||||||||||||
| - For each deduction and tax, a higher `priority` value indicates this item should be withheld first. | ||||||||||||||||||||||||||
| - If a deduction or tax is cannot be withheld to the full amount, the deficit is recorded. | ||||||||||||||||||||||||||
| - Output the following | ||||||||||||||||||||||||||
| - Gross pay | ||||||||||||||||||||||||||
| - Net pay to employee | ||||||||||||||||||||||||||
| - Amounts withheld for deductions and taxes by code with deficits | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| Sample input object: | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ```json | ||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| "earnings": [ | ||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| "code": "overtime", | ||||||||||||||||||||||||||
| "type": "hourly", | ||||||||||||||||||||||||||
| "hours": 20, | ||||||||||||||||||||||||||
| "rate": 15, | ||||||||||||||||||||||||||
| "isTaxable": true | ||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| "code": "regular", | ||||||||||||||||||||||||||
| "type": "hourly", | ||||||||||||||||||||||||||
| "hours": 20, | ||||||||||||||||||||||||||
| "rate": 13, | ||||||||||||||||||||||||||
| "isTaxable": false | ||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| "code": "bonus", | ||||||||||||||||||||||||||
| "type": "salary", | ||||||||||||||||||||||||||
| "amount": 1500, | ||||||||||||||||||||||||||
| "isTaxable": true | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| ], | ||||||||||||||||||||||||||
| "deductions": [ | ||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| "code": "401k", | ||||||||||||||||||||||||||
| "type": "percentage", | ||||||||||||||||||||||||||
| "priority": 1, | ||||||||||||||||||||||||||
| "value": 10, | ||||||||||||||||||||||||||
| "isPreTax": false | ||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| "code": "healthInsurance", | ||||||||||||||||||||||||||
| "type": "flat", | ||||||||||||||||||||||||||
| "priority": 2, | ||||||||||||||||||||||||||
| "value": 20, | ||||||||||||||||||||||||||
| "isPreTax": true | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| ], | ||||||||||||||||||||||||||
| "taxes": [ | ||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| "code": "federalIncome", | ||||||||||||||||||||||||||
| "type": "percentage", | ||||||||||||||||||||||||||
| "priority": 1, | ||||||||||||||||||||||||||
| "value": 10 | ||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| "code": "fica", | ||||||||||||||||||||||||||
| "type": "cappedPercentage", | ||||||||||||||||||||||||||
| "priority": 2, | ||||||||||||||||||||||||||
| "value": 10, | ||||||||||||||||||||||||||
| "cap": 50 | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| ] | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| # Gross-to-Net Payroll Calculator | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| Implement the `Calculate` method in `PayrollCalculator.cs` which accepts three collections as arguments... `earnings`, `deductions`, and `taxes` then returns a `PayrollResult` with `grossPay`, `grossTaxableEarnings`, a list of `witholdings`, and `netPay`. | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ## Requirements | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ### NetPay Calculation | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| `NetPay = GrossTaxableEarnings - PreTaxDeductions - Taxes - PostTaxDeductions + NonTaxableEarnings` | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ### Earnings | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| - Types: `salary`, `hourly` | ||||||||||||||||||||||||||
| - Salary earnings have a flat `amount` | ||||||||||||||||||||||||||
| - Hourly earnings amount is `hours × rate` | ||||||||||||||||||||||||||
| - Only taxable earnings are included when calculating deductions/taxes | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ### Deductions | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| - Types: `flat`, `percentage` | ||||||||||||||||||||||||||
| - Flat decductions have a fixed dollar `value` | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
| - Flat decductions have a fixed dollar `value` | |
| - Flat deductions have a fixed dollar `value` |
Copilot
AI
Dec 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Documentation error: The property is named isPreTax (not isPrefix). This should be corrected to match the actual model property in Deduction.cs.
| - Deductions are either Pre-Tax or Post-Tax depending on the `isPrefix` value. | |
| - Deductions are either Pre-Tax or Post-Tax depending on the `isPreTax` value. |
Copilot
AI
Dec 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spelling error: "Witholding" should be "Withholding".
| - Witholding groups are applied using the following order: | |
| - Withholding groups are applied using the following order: |
Copilot
AI
Dec 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spelling error: "Witholdings" should be "Withholdings".
| ### Witholdings | |
| - Types: `tax`, `deductions` | |
| - Deductions are either Pre-Tax or Post-Tax depending on the `isPrefix` value. | |
| - Witholding groups are applied using the following order: | |
| ### Withholdings | |
| - Types: `tax`, `deductions` | |
| - Deductions are either Pre-Tax or Post-Tax depending on the `isPrefix` value. | |
| - Withholding groups are applied using the following order: |
Copilot
AI
Dec 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spelling error: "assesmments" should be "assessments".
| An online VSCode codespace will be used during assesmments and candidates are free to install extensions available in the vs code default extension marketplace. | |
| An online VSCode codespace will be used during assessments and candidates are free to install extensions available in the vs code default extension marketplace. |
Copilot
AI
Dec 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spelling error: "Commmand-line" has an extra 'm' and should be "Command-line".
| ### Commmand-line | |
| ### Command-line |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| Folder PATH listing for volume Windows | ||
| Volume serial number is 7EA5-7906 | ||
| C:. | ||
| | advanced-test-cases.json | ||
| | directory-structure.txt | ||
| | input.json | ||
| | INTERVIEWER_README.md | ||
| | README.md | ||
| | test-cases.json | ||
| | | ||
| \---dotnet | ||
| | GrossToNet.csproj | ||
| | PayrollCalculator.cs | ||
| | Program.cs | ||
| | | ||
| +---bin | ||
| | \---Debug | ||
| | \---net8.0 | ||
| | advanced-test-cases.json | ||
| | GrossToNet.deps.json | ||
| | GrossToNet.dll | ||
| | GrossToNet.exe | ||
| | GrossToNet.pdb | ||
| | GrossToNet.runtimeconfig.json | ||
| | input.json | ||
| | test-cases.json | ||
| | | ||
| +---models | ||
| | Deduction.cs | ||
| | Earning.cs | ||
| | PayrollData.cs | ||
| | PayrollResult.cs | ||
| | Tax.cs | ||
| | Withholding.cs | ||
| | | ||
| \---obj | ||
| | GrossToNet.csproj.nuget.dgspec.json | ||
| | GrossToNet.csproj.nuget.g.props | ||
| | GrossToNet.csproj.nuget.g.targets | ||
| | project.assets.json | ||
| | project.nuget.cache | ||
| | | ||
| \---Debug | ||
| \---net8.0 | ||
| | .NETCoreApp,Version=v8.0.AssemblyAttributes.cs | ||
| | apphost.exe | ||
| | GrossToNet.AssemblyInfo.cs | ||
| | GrossToNet.AssemblyInfoInputs.cache | ||
| | GrossToNet.assets.cache | ||
| | GrossToNet.csproj.CoreCompileInputs.cache | ||
| | GrossToNet.csproj.FileListAbsolute.txt | ||
| | GrossToNet.dll | ||
| | GrossToNet.GeneratedMSBuildEditorConfig.editorconfig | ||
| | GrossToNet.genruntimeconfig.cache | ||
| | GrossToNet.GlobalUsings.g.cs | ||
| | GrossToNet.pdb | ||
| | GrossToNet.sourcelink.json | ||
| | | ||
| +---ref | ||
| | GrossToNet.dll | ||
| | | ||
| \---refint | ||
| GrossToNet.dll | ||
|
|
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -7,9 +7,10 @@ | |||||
| <ImplicitUsings>enable</ImplicitUsings> | ||||||
| <Nullable>enable</Nullable> | ||||||
| </PropertyGroup> | ||||||
|
|
||||||
| <ItemGroup> | ||||||
| <Content Include="../input.json"> | ||||||
| <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||||||
| <Content Include="test-cases.json"> | ||||||
| <CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||||||
| </Content> | ||||||
| </ItemGroup> | ||||||
| </Project> | ||||||
| </ItemGroup> | ||||||
|
||||||
| </ItemGroup> | |
| </ItemGroup> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| using GrossToNet.Models; | ||
|
|
||
| namespace GrossToNet; | ||
|
|
||
| /// <summary> | ||
| /// Payroll calculator that processes earnings, deductions, and taxes to compute net pay. | ||
| /// | ||
| /// CALCULATION: Net pay = gross pay - pre-tax deductions - taxes - post-tax deductions | ||
| /// | ||
| /// See README.md for detailed requirements and examples. | ||
| /// </summary> | ||
| public class PayrollCalculator | ||
| { | ||
| public PayrollResult Calculate(IEnumerable<Earning> earnings, IEnumerable<Deduction> deductions, IEnumerable<Tax> taxes) | ||
| { | ||
|
|
||
| // TODO: Implement payroll calculation logic here | ||
| throw new NotImplementedException("Payroll calculation not yet implemented. Please implement the Calculate method."); | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spelling error: "witholdings" should be "withholdings".