Open Source Your Knowledge, Become a Contributor
Technology knowledge has to be shared and made accessible for free. Join the movement.
Welcome!
This C# playground demonstrates a simple sales tax calculation module that hasn't been tested yet, Can you find the errors and fix the code before it's used by customers?
Hands-on Demo
Golly, what is wrong with my sales tax calculator?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
using System;
using System.Linq;
using System.Text;
namespace Answer
{
public class SalesTaxCalculatorStub
{
public static decimal GetTotalAmount(decimal itemPrice, decimal taxRatePercent)
{
decimal taxRate = taxRatePercent / 10 ; //fix me
return itemPrice + (itemPrice * taxRatePercent); //what?
}
}
}
//}
Enter to Rename, Shift+Enter to Preview
Open Source Your Knowledge: become a Contributor and help others learn. Create New Content