Friday, February 28, 2014

CD_SaleRegisterWithDouble: (Wk-2) Jan 15, 2014

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SaleRegWithDouble
{
    class Program
    {
        static void Main(string[] args)
        {
            double quantity, subtotal, saletax, totalcost;

            double cdcost = 1.20;
            double tax = 0.098;

            Console.WriteLine("Enter CD purchased: ");
            quantity = Convert.ToDouble(Console.ReadLine());

            subtotal = quantity * cdcost;
            saletax = subtotal * tax;

            totalcost = subtotal + saletax;

            Console.WriteLine("Total Cost: {0:c}", totalcost);
            Console.ReadLine();
        }
    }
}

No comments:

Post a Comment