Guest User

Untitled

a guest
Jan 20th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.69 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 payroll
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             string[] names = { "tanya", "dana", "sara", "scott", "paul", "dale", "bret", "karen", "tracy" };
  14.             int[] hours = { 40, 45, 38, 42, 48, 40, 35, 48, 36 };
  15.             double[] rates = { 7.5, 14.9, 12, 9.75, 8.72, 10.25, 8, 9, 11 };
  16.  
  17.             Console.WriteLine("Employee Hours\tRegular\tOT\tGross\nName\tWorked\tPay\tPay\tPay\tFIT\tNet Pay");
  18.  
  19.  
  20.             for (int x = 0; x < names.Length; x++)
  21.             {
  22.                double regularPay=0;
  23.                double overtimePay = 0;
  24.                double grossPay = 0;
  25.                double fit = 0;
  26.                double netPay = 0;
  27.  
  28.                if (hours[x] > 40)
  29.                {
  30.                    regularPay = 40 * rates[x];
  31.                    overtimePay = (hours[x] - 40) * 1.5 * rates[x];
  32.                }
  33.                else
  34.                {
  35.                    regularPay = hours[x] * rates[x];
  36.                    overtimePay = 0;
  37.                }
  38.  
  39.                grossPay = regularPay + overtimePay;
  40.                fit = grossPay * fit;
  41.                netPay = grossPay - fit;
  42.  
  43.                
  44.                 Console.WriteLine(names[x] + "\t" + hours[x] + "\t$" + regularPay + "\t$" + overtimePay + "\t$" + grossPay + "\t$" + fit + "\t$" + netPay);
  45.  
  46.             }
  47.  
  48.            
  49.             Console.ReadLine();
  50.            // new worker =
  51.  
  52.         }
  53.     }
  54.  
  55.     class worker
  56.     {
  57.         public string name;
  58.         public int hours;
  59.         public double rate;
  60.     }
  61.  
  62. }
Add Comment
Please, Sign In to add comment