Advertisement
DashWaLLker

dat johnny doe

Mar 13th, 2015
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.24 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. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             string name;
  14.             float hourlyRate;
  15.             int hoursWorked;
  16.             double grossPay, totalPayG, totalPayN, netPay, afterTaxes;
  17.             double socialSecurity = .075;
  18.             double federalTax = .2;
  19.  
  20.             Console.WriteLine("Hello! This program is designed to help you calculate your net pay.");
  21.             Console.WriteLine("First, what is your name?");
  22.             name = Console.ReadLine(); Console.WriteLine();
  23.  
  24.             Console.WriteLine("Hello" + name + " What is your hourly rate?");
  25.             hourlyRate = float.Parse(Console.ReadLine());
  26.             while(hourlyRate <7.50)
  27.             {
  28.                 Console.WriteLine("We're sorry, this value is far too low. Please enter an hourly rate above $7.50");
  29.                 hourlyRate = float.Parse(Console.ReadLine());
  30.             }
  31.  
  32.             Console.WriteLine("Now enter your total amount of hours worked");
  33.             hoursWorked = int.Parse(Console.ReadLine());
  34.             while(hoursWorked > 40)
  35.             {
  36.                 Console.WriteLine("We're sorry, this value is far too high. Please enter a total number of hours under 40");
  37.                 hoursWorked = int.Parse(Console.ReadLine());
  38.             }
  39.  
  40.             grossPay = hourlyRate * hoursWorked;
  41.  
  42.             afterTaxes = grossPay * federalTax;
  43.  
  44.             totalPayG = grossPay - afterTaxes;
  45.  
  46.             totalPayN = totalPayG * socialSecurity;
  47.  
  48.             netPay = grossPay - totalPayN;
  49.  
  50.             Console.WriteLine("Hello" + name + "It seems that your Gross Pay is $" + grossPay + " However, after Federal Tax and Social Security fees, your Net Pay is exactly: $" + netPay);
  51.             if (netPay > 1000)
  52.                 Console.WriteLine("Congratulations! You make over $1000 a week? You seem to be doing very well for yourself!");
  53.  
  54.             Console.WriteLine("Congratulations " + name + " You have calculated your netPay. Please terminate the program. Have a  nice day!");
  55.             Console.ReadKey();
  56.         }
  57.     }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement