Sunday, March 16, 2014

MultipleCondition_Ex_3: (Wk-4), Jan 27-31, 2014

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

namespace MultipleCondition_Ex_3
{
    class Program
    {
        static void Main(string[] args)
        {
            //A sale person commission is
            //5% on the first $5000 in sales
            //10% on sales between $5000 and $10000
            //15% on sales between $10000 and $15000
            //20% on anything above $15000
            //Request amount of sales for a sales person, then compute
            //the amount of commission made by the sales person


            repeat:
            Console.Write("Enter the sale amount: ");
            uint sale = uint.Parse(Console.ReadLine());

            double commission;
            if (sale < 5000)
            {
                commission = sale * 5 / 100;
            }
            else if (sale >= 5000 && sale < 10000)
            {
                commission = sale * 10 / 100;
            }
            else if (sale >= 10000 && sale < 15000)
            {
                commission = sale * 15 / 100;
            }
            else
            {
                commission = sale * 20 / 100;
            }
            Console.WriteLine("Commission: {0:c}", commission);
            Console.ReadLine();
            Console.Clear();
            goto repeat;
        }
    }
}

No comments:

Post a Comment