<pre lang="text"><pre lang="cs">namespace VS_Sand_Box
{
class Program
{
static void Main(string[] args)
{
{
string customerName, customerState;
int unitAmount;
double unitPrice, totalPrice, totalTax;
Console.Write("Enter the customer's name: ");
customerName = Console.ReadLine();
Console.Write("Enter the location of transaction i.e.(NJ, FL, or NY): ");
customerState = Console.ReadLine();
Console.Write("Enter the amount of units being purchased: ");
unitAmount = Int32.Parse(Console.ReadLine());
Console.Write("Enter the price per unit: ");
unitPrice = Double.Parse(Console.ReadLine());
totalPrice = computeTotal(unitAmount, unitPrice);
totalTax = computeTax(totalPrice, customerState);
Console.WriteLine("\n\nThe total sales for " + customerName + " are " + totalPrice.ToString("C2"));
Console.Write("The tax amount is " + totalTax.ToString("C2"));
Console.WriteLine("\nThe total with tax is $" + (totalTax + totalPrice));
Console.ReadLine();
}
}
public static double computeTotal (int qty, double price)
{
return (qty * price);
}
public static double computeTax (double totalPrices, string customerState)
{
if (customerState == "NJ")
return totalPrices * .07;
else if (customerState == "FL")
return totalPrices * .04;
else if (customerState == "NY")
return totalPrices * .06;
else
return 0;
}
}
}