Answer to Question #14474 in C# for Bongani

Question #14474
My question is how to write a C # console application that prompts the user fora name , social security number, hourly pay rate, and number of hours worked. Display all the input data as well as the the following:

--Gross Pay, defined as hourly pay rate times hours worked
--Pension fund, defined as 12% of the gross pay
--State withholding tax, defined as 15% of the gross pay
net pay, defined as gross pay minus taxes?
Expert's answer
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Question14474
class Program
static void Main(string[] args)
double GrossPay;
double Pensionfund;
double Statewithholdingtax;
string name;
string socialsecuritynumber;
double hourlypayrate;
double numberofhoursworked;
Console.Write("Enter name: ");
name = Console.ReadLine();
Console.Write("Enter social security number: ");
socialsecuritynumber =Console.ReadLine();
Console.Write("Enter hourly pay rate: ");
hourlypayrate = double.Parse(Console.ReadLine());
Console.Write("Enter number of hours worked: ");
numberofhoursworked = double.Parse(Console.ReadLine());
GrossPay = hourlypayrate * numberofhoursworked;
Pensionfund = GrossPay * 0.12;
Statewithholdingtax = GrossPay * 0.15;
Console.WriteLine("Gross Pay= " + GrossPay.ToString());
Console.WriteLine("Pension fund= " + Pensionfund.ToString());
Console.WriteLine("State withholding tax= " + Statewithholdingtax.ToString());

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!


No comments. Be the first!

Leave a comment

Ask Your question

New on Blog