Answer to Question #284274 in C# for Kim

Question #284274

Create a program that will compute for the weekly Net pay of an employee based

on any input Hours and Rate. Any hour/s exceeds the regular 40 hours is entitled to an

Overtime pay, wherein Overtime pay = Hours - 40 x Rate x 1.5.

Deductions are as follows:

Tax = 5% of Gross Pay

Union = 2% of Gross Pay

SaLoan = 590.32 (Fixed Amount)

Gross Pay = (Hours > 40? 40 X Rate + Overtime pay: Hours x Rate)

Deductions = Tax + Union + SaLoan

Net Pay = Gross Pay - Deductions


1
Expert's answer
2022-01-02T08:16:03-0500
using System;
using System.Collections.Generic;


namespace App
{


    class Program
    {
        public static void Main()
        {


            Console.Write("Enter Hours: ");
            double hours = double.Parse(Console.ReadLine());
            Console.Write("Enter Rate: ");
            double rate = double.Parse(Console.ReadLine());


            //Gross Pay = (Hours > 40? 40 X Rate + Overtime pay: Hours x Rate)
            double overtimePay = (hours - 40) * rate * 1.5;
            double grossPay = (hours > 40 ? 40 * rate + overtimePay : hours * rate);


            //Tax = 5% of Gross Pay
            double tax = grossPay * 0.05;
            //Union = 2% of Gross Pay
            double union = grossPay * 0.02;
            //SaLoan = 590.32 (Fixed Amount)
            double saLoan = 590.32;
            //Deductions = Tax + Union + SaLoan
            double deductions = tax + union + saLoan;
            //Net Pay = Gross Pay - Deductions
            double netPay = tax + union + saLoan;


            Console.WriteLine("\nGross pay: {0}", grossPay);
            Console.WriteLine("Tax: {0}", tax);
            Console.WriteLine("Union: {0}", union);
            Console.WriteLine("SaLoan: {0}", saLoan);
            Console.WriteLine("Deductions: {0}", deductions);
            Console.WriteLine("Net Pay: {0}", netPay);


            Console.ReadLine();
        }
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS