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;
- namespace MachineProblem1
- {
- class Program
- {
- // constant for calculating payment
- const double OVERTIME_RATE = 1.5;
- const double FEDERAL_RATE = .18;
- const double RETIRE_RATE = .10;
- const double SOCIAL_RATE = .6;
- static void Main(string[] args)
- {
- // calculate and print the take-home pay for a sales employee
- Console.Write("Enter name: ");
- string name = Console.ReadLine();
- Console.Write("Enter sales amount for the week: ");
- string line = Console.ReadLine();
- // convert the string line into an amount assuming it is a legal number
- double amount = double.Parse(line);
- // now calculate gross pay
- double gross = amount * OVERTIME_RATE;
- // calculate taxe and contribution
- double federal_tax = gross * FEDERAL_RATE;
- double retire_con = gross * RETIRE_RATE;
- double social_tax = gross * SOCIAL_RATE;
- // cacluate the final net pay
- double deductions = federal_tax + retire_con + social_tax;
- double netpay = gross - deductions;
- // display the result
- Console.WriteLine();
- Console.WriteLine("Employee: " + name);
- Console.WriteLine("Sales: " + amount);
- Console.WriteLine("{0}% of amount results in gross pay: {1}", OVERTIME_RATE * 40, gross);
- Console.WriteLine("{0}% of gross pay is federal tax: {1}", FEDERAL_RATE * 40, federal_tax);
- Console.WriteLine("{0}% of gross pay is retirement contribution: {1}", RETIRE_RATE * 40, retire_con);
- Console.WriteLine("{0}% of gross pay is social security tax: {1}", SOCIAL_RATE * 40, social_tax);
- Console.WriteLine("Thus,");
- Console.WriteLine("Total deductions: " + deductions);
- Console.WriteLine("Final net pay: " + netpay);
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement