How are you getting the prices of the bill?
https://www.nasdaq.com/articles/how-calculate-price-treasury-bills-2016-01-05
https://jeremyshanks.com/creating-a-simple-tax-calculator-console-app-in-csharp/
public class TaxCalculator
{
private static decimal _itemPrice;
private static decimal _percentTaxRate;
private static decimal _totalPrice;
public TaxCalculator(string inputItemPrice, string inputTaxRate)
{
_itemPrice = Decimal.Parse(inputItemPrice);
_percentTaxRate = Decimal.Parse(inputTaxRate) / 100;
}
public void CalculateTotalPrice()
{
_totalPrice = _itemPrice + (_itemPrice * _percentTaxRate);
}
public void GetTotalMsg()
{
Console.WriteLine("The subtotal is {0:C} and the total price is {1:C} at the tax rate of {2:p0}", _itemPrice, _totalPrice, _percentTaxRate);
}
}
Comments
Leave a comment