Advertisement
fannyxmikasa

Untitled

Oct 21st, 2020
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.08 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApplication1
  8. {   class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             string value;
  13.             int val;
  14.             double totalAllowance,totalDeduction;
  15.             Console.Write("Enter basic salary: ");
  16.             value = Console.ReadLine();
  17.             val = Convert.ToInt32(value);
  18.             Console.WriteLine("--------------------------------------------------------------------------");
  19.  
  20.             Console.WriteLine("Allowances\t\t\t\t\tDeductions\n");
  21.             Console.Write("HRA\t\t: {0:n2}", 0.15 * val);
  22.             Console.WriteLine("\t\t\tSS\t\t: {0:n2}", 0.07 * val);
  23.             Console.Write("DA\t\t: {0:n2}", 0.10 * val);
  24.             Console.WriteLine("\t\t\tLevy\t\t: {0:n2}", 0.01 * val);
  25.             Console.Write("EA\t\t: {0:n2}", 0.05 * val);
  26.             totalDeduction = computeDeductions((0.07 * val), (0.01 * val));
  27.             Console.WriteLine("\t\t\tDeductions\t: {0:n2}",totalDeduction );
  28.             Console.WriteLine("TA\t\t: {0:n2}", 0.12 * val);
  29.             totalAllowance = computeAllowance((0.15 * val), (0.10 * val), (0.05 * val), (0.12 * val));
  30.             Console.WriteLine("Allowances\t: {0:n2}", totalAllowance);
  31.             Console.WriteLine("--------------------------------------------------------------------------");
  32.             Console.WriteLine("Gross Salary\t\t: {0:n2}",grossSalary(val,totalAllowance));
  33.             Console.WriteLine("Gross Salary\t\t: {0:n2}\n", netSalary(grossSalary(val, totalAllowance), totalDeduction));    
  34.         }
  35.         static double computeAllowance(double hra, double da, double ea, double ta)
  36.         {   return hra + da + ea + ta;  }
  37.         static double computeDeductions(double ss, double levy)
  38.         {   return ss + levy;   }
  39.         static double grossSalary(int basic, double allowance)
  40.         { return basic + allowance; }
  41.         static double netSalary(double gross, double deduct)
  42.         { return gross - deduct; }
  43.     }
  44. }
  45.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement