TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Jenni Witzel
NA
27
0
I need help with my C# Homework ? What did I do wrong.
Oct 13 2008 10:04 PM
This program is suppose to takes input from the user, calculates payroll information. I dont know what i did wrong, did i miss something
using System;
using SC = System.Console;
public class JKingLab04
{ // Main Method
public static void Main()
{
Double hoursWorked, payRate;
Double grossPay, stateTax, federalTax = 0, dblFICA = 0,
netPay = 0;
SC.WriteLine("Lab 4 – Jenni King");
SC.Write("\nPlease input hours worked: ");
hoursWorkedStr = SC.ReadLine();
SC.Write("\nPlease input rate of pay: ");
payRateStr = SC.ReadLine();
hoursWorked = Convert.ToDouble(hoursWorkedStr);
payRate = Convert.ToDouble(payRateStr);
grossPay = CalcGrossPay(hoursWorked, payRate);
CalcStateTax(out stateTax, grossPay);
CalcFedTax(ref federalTax, ref grossPay);
CalcFICATax(ref dblFICA, ref grossPay);
CalcNetPay(ref netPay, ref grossPay, ref stateTax,
ref federalTax, ref dblFICA);
SC.WriteLine("grossPay = hoursWorked * rateOfPay");
}
public static double CalcGrossPay(double hours, double rate)
{
double gross;
gross = hours * rate;
return gross;
}
public static void CalcStateTax(out double stateTax, double grossPay)
{
stateTax = grossPay * 0.04;
}
public static void CalcFedTax(ref double federalTax, ref double grossPay)
{
federalTax = grossPay * 0.23;
}
public static void CalcFICATax(ref double fica, ref double grossPay)
{
fica = grossPay * 0.14;
}
public static void CalcNetPay(ref double netPay, ref double grossPay,
ref double stateTax, ref double federalTax, ref double dblFICA)
{
netPay = grossPay - (0.04 + 0.23 + 0.14);
grossPay = hoursWorked * rateOfPay;
stateTax = grossPay * 0.04;
federalTax = grossPay * 0.23;
dblFICA = grossPay * 0.14;
}
}
Reply
Answers (
2
)
Handling annoying JavaScript alerts
Load & Record Process?