How Do I in C#
How Do I is your gateway to key task-based topics about C# programming and application development. The essential categories for what you can do with C# are listed in this topic. The links guide you to important procedure-based Help pages.
/***************************************************************************************
* Programming Assignment: HW2- Page 133, Exercise #5
* Developer: _______________________
* Date Written: _______________________
* Purpose: This program calculates take home pay based on commission
* rate, weekly sales, tax rate, social security rate, and
* retirement fund contribution rate.
*
* Algorithm:
* 1. define variables: employeeName, totalSales, userInput, commission, fedTaxPaid,
* socSecPaid, retirementPaid, takeHomePay
* 2. define constants:
* COMMISSION_RATE = 0.07
* FEDERAL_TAX_RATE = 0.18
* SOCIAL_SECURITY_RATE = 0.06
* RETIREMENT_CONTRIBUTION = 0.10
* 3. input employee name
* 4. input totalSales
* 5. calculate commission = totalSales * COMMISSION_RATE
* 6. calculate fedTaxPaid = commission * FEDERAL_TAX_RATE
* 7. calculate socSecPaid = commission * SOCIAL_SECURITY_RATE
* 8. calculate retirementPaid = commission * RETIREMENT_CONTRIBUTION
* 9. calculate takeHomePay = commission - (fedTaxPaid + socSecPaid + retirementPaid)
* 10. Output commission, fedTaxPaid, retirementPaid, socSecPaid, takeHomePay
**************************************************************************************/
using
System;namespace
Ch03_05{
classCalculateTakeHomePay
{
staticvoid Main()
{
// step 1
string employeeName,
userInput;
double totalSales,
Sales,
commission,
fedTaxPaid,
socSecPaid,
retirementPaid,
takeHomePay;
// step 2
constdouble COMMISSION_RATE = 0.07;
constdouble FEDERAL_TAX_RATE = 0.18;
constdouble SOCIAL_SECURITY_RATE = 0.06;
constdouble RETIREMENT_CONTRIBUTION = 0.10;
// step 3
Console.Write(" INPUT EMPLOYEE NAME: \n");
employeeName =
Console.ReadLine(1)employeeName;// step 4
Console.Write(" INPUT TOTAL SALES : ");
totalSales =
Console.ReadLine(0);totalSales =
Console.WriteLine ("(0)Total Sales )\n",totalSales);commission = totalSales * COMMISSION_RATE;
// step 5fedTaxPaid = commission * FEDERAL_TAX_RATE;
// step 6socSecPaid = commission * RETIREMENT_CONTRIBUTION;
// step 7retirementPaid = commission * RETIREMENT_CONTRIBUTION;
// step 8takeHomePay = commission - (fedTaxPaid + socSecPaid + retirementPaid);
// step 9// step 10
// Console.WriteLine("\n\n COMMISSION {_____}", ________);
//Console.WriteLine(" FEDERAL TAX {_____}", ____________);
//Console.WriteLine(" RETIREMENT {_____}", ____________);
//Console.WriteLine(" SOCIAL SECURITY {_____}", ____________);
//Console.WriteLine("\n TAKE HOME PAY {_____}\n\n", __________);
}
}
}
// Console.WriteLine("(0) worked {1} hours at {2:c}\n",name, hours, rate); (this is sample code from a program I built
// in class.
[tfl - 23 11 09] Hi - and thanks for your post. You should post questions like this to the MSDN Forums at http://forums.microsoft.com/msdn or the MSDN Newsgroups at http://www.microsoft.com/communities/newsgroups/en-us/. You are much more likely get a quicker response using the forums than through the Community Content. For specific help about:
Visual Studio : http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public.vstudio%2C&
SQL Server : http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public.sqlserver%2C&
.NET Framework : http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public.dotnet.framework
PowerShell : http://groups.google.com/group/microsoft.public.windows.powershell/topics?pli=1
All Public : http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public%2C&
And whilst writing - when you post there, you might consider stripping out your homework details from the specifc issue you have with C# along with the error you are having. Folks will happily answer specific questions, but most baulk at doing homework for you. :-) I hope this helps you get the assistance you are looking for.
- 11/5/2009
- Jason_A_T
- 11/23/2009
- Thomas Lee