Netlinkaccess - All about Payroll Services and Accounting
*Home>>>Payroll Program

State that a program performs a sample payroll calculation (i.e., use text that helps to doc a prog ) in c#?


can any one help me

Here is the C# adaption:

using System;

public class Payroll {

public static void Main(string[] args) {
// Prompt the user to input stuff
Console.WriteLine("Enter an employee's name: ");
string empName = Console.ReadLine();

Console.WriteLine("Enter the number of hours worked in a week: ");
double hoursWorked = Convert.ToDouble( Console.ReadLine() );

Console.WriteLine("Enter the hourly pay rate: ");
double payRate = Convert.ToDouble(Console.ReadLine());

Console.WriteLine("Enter Federal tax withholding rate: ");
double federalTaxRate = Convert.ToDouble(Console.ReadLine());
federalTaxRate = federalTaxRate / 100;

Console.WriteLine("Enter state tax withholding rate: ");
double stateTaxRate = Convert.ToDouble( Console.ReadLine() );
stateTaxRate = stateTaxRate / 100;

// Calculate stuff
double grossPay = hoursWorked * payRate;
double federalWithholding = grossPay * federalTaxRate;
double stateWithholding = grossPay * stateTaxRate;
double totalDeductions = federalWithholding + stateWithholding;
double netPay = grossPay - totalDeductions;

//Here is where the output (stuff) should be a payroll statement
Console.WriteLine("Employee Name: " + empName);
Console.WriteLine("Hours worked: " + hoursWorked);
Console.WriteLine("Pay Rate: " + payRate);
Console.WriteLine("Gross Pay: " + grossPay);
Console.WriteLine("Deductions... ");
Console.WriteLine("Federal Withholding (" + federalTaxRate + "%) : " + federalWithholding);
Console.WriteLine("State Withholding (" + stateTaxRate + "%) : " + stateWithholding);
Console.WriteLine("Total Deduction: " + totalDeductions);
Console.WriteLine("Net Pay: " + netPay);
Console.WriteLine("Press Enter key to exit");
Console.ReadLine();
}
}

here is my answer in java... c sharp is relatively close to java no?

import java.util.Scanner; // Scanner is in java.util

public class Payroll {
public static void main(String args[]) {
// Create a Scanner
Scanner scanner = new Scanner(System.in);


// Prompt the user to input stuff
System.out.print("Enter an employee's name: ");
String empName = scanner.next();
System.out.print("Enter the number of hours worked in a week: ");
double hoursWorked = scanner.nextDouble();
System.out.print("Enter the hourly pay rate: ");
double payRate = scanner.nextDouble();
System.out.print("Enter Federal tax withholding rate: ");
double federalTaxRate = scanner.nextDouble();
federalTaxRate = federalTaxRate / 100;
System.out.print("Enter state tax withholding rate: ");
double stateTaxRate = scanner.nextDouble();
stateTaxRate = stateTaxRate / 100;

// Calculate stuff
double grossPay = hoursWorked * payRate;
double federalWithholding = grossPay * federalTaxRate;
double stateWithholding = grossPay * stateTaxRate;
double totalDeductions = federalWithholding + stateWithholding;
double netPay = grossPay - totalDeductions;

//Here is where the output (stuff) should be a payroll statement
System.out.println("Employee Name: " + empName);
System.out.println("Hours worked: " + hoursWorked);
System.out.println("Pay Rate: " + payRate);
System.out.println("Gross Pay: " + grossPay);
System.out.println("Deductions: ");
System.out.println("Federal Withholding (" + federalTaxRate + "%) : " + federalWithholding);
System.out.println("State Withholding (" + stateTaxRate + "%) : " + stateWithholding);
System.out.println("Total Deduction: " + totalDeductions);
System.out.println("Net Pay: " + netPay);
}
}

Tags
  Payroll Card   Payroll Tax   Payroll Accounting   Online Payroll   Adp Payroll   Payroll Program   Payroll Software   Payroll System   Payroll Processing   Payroll Services
Related information
  • I want to maintain payroll in Tally 9 program , how can I ?

    Put the information in the Tally 9, and if it does work, take your Tallywhacker out and beat it.

    ...
  • How to make a program for payroll?

    you should use microsoft access.

    ...
  • How does a payroll draw program work?

    You set a specific draw amount, say $1000 a month, which would be $461.54 per paycheck if you pay every 2 weeks. When the employee's calculated commissions go over that after closing the mont...

  • Any one know where i can download a sage line 50 training program and also a sage payroll program?

    ...

  • How do you write a payroll program in c++ to calculate monthly,forthnightly &weekly empolyee salary?

    The quick answer is that you would know how to program in c++. I dont think most people would want to write that for you just to give an answer but you never know. Try using planetsourcecode an...

  • Need help adding to exsisting java code to modify a program. Please help!!?

    Didn't change up your program to terribly much, just added the extra Employee object at the end and slightly modified your original program to use it. import java.util.Scanner; public cl...

  • C++ Program IST240 PSU Help NEEDED!!?

    // Bart Simpsons writing int main() { return bart_simpson_writing_on_blackboard(); } int bart_simpson_writing_on_blackboard() { cout << "I will do my own homework."; c...

  • Indiana has ended a program that put a chaplain position on the payroll. Do you find paying clergy acceptable?

    absolutely not. church & state are supposed to be sepperate. i dont go to church and i understand that some people feel they need it, but they can pay for it themselves. im not gonna pay for th...

  •  

    Categories--Copyright/IP Policy--Contact Webmaster