Saturday, March 15, 2014

MultipleCondition_Ex_2: (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_2
{
    class Program
    {
        static void Main(string[] args)
        {
            //Q. A sale person makes bonus according to his/her sales in a month
            //Bonus:    $200 if sale are above $5000
            //          $500 if sale are above $10,000
            //          $1000 if sale are above $20,000
            //          $1500 if sale are above $30,000
            //if the sale person base salary is $5000,
            //determine his/her monthly salary based on sales.


            Console.Write("Enter the sale amount: ");
            uint sale = uint.Parse(Console.ReadLine());
            double totalEarning;
            if (sale < 5000)
            {
                totalEarning = 5000;
            }
            else if (sale >= 5000 && sale < 10000)
            {
                totalEarning = 5000 + 200;
            }
            else if (sale > 10000 && sale < 20000)
            {
                totalEarning = 5000 + 500;
            }
            else if (sale > 20000 && sale < 30000)
            {
                totalEarning = 5000 + 1000;
            }
            else
            {
                totalEarning = 5000 + 1500;
            }
            Console.WriteLine("\nTotal Earning: {0:c}", totalEarning);
            Console.ReadLine();
        }
    }
}

No comments:

Post a Comment