Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication1
- {
- class Program
- {
- static void Main(string[] args)
- {
- string name;
- float hourlyRate;
- int hoursWorked;
- double grossPay, totalPayG, totalPayN, netPay, afterTaxes;
- double socialSecurity = .075;
- double federalTax = .2;
- Console.WriteLine("Hello! This program is designed to help you calculate your net pay.");
- Console.WriteLine("First, what is your name?");
- name = Console.ReadLine(); Console.WriteLine();
- Console.WriteLine("Hello" + name + " What is your hourly rate?");
- hourlyRate = float.Parse(Console.ReadLine());
- while(hourlyRate <7.50)
- {
- Console.WriteLine("We're sorry, this value is far too low. Please enter an hourly rate above $7.50");
- hourlyRate = float.Parse(Console.ReadLine());
- }
- Console.WriteLine("Now enter your total amount of hours worked");
- hoursWorked = int.Parse(Console.ReadLine());
- while(hoursWorked > 40)
- {
- Console.WriteLine("We're sorry, this value is far too high. Please enter a total number of hours under 40");
- hoursWorked = int.Parse(Console.ReadLine());
- }
- grossPay = hourlyRate * hoursWorked;
- afterTaxes = grossPay * federalTax;
- totalPayG = grossPay - afterTaxes;
- totalPayN = totalPayG * socialSecurity;
- netPay = grossPay - totalPayN;
- 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);
- if (netPay > 1000)
- Console.WriteLine("Congratulations! You make over $1000 a week? You seem to be doing very well for yourself!");
- Console.WriteLine("Congratulations " + name + " You have calculated your netPay. Please terminate the program. Have a nice day!");
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement