Write a program that calculates and prints the take-home pay for a commissioned sales employee. Perform a compile-time initialization and store the name of Nesbith Lang in a variable called employeeName. Nesbith earns 7% of her total sales as her commission. Her federal tax rate is 18%. She contributes 10% to a retirement program and 6% to Social Security. Her sales this month were $161,432. Produce a formatted report showing the amount for each of the computed items. Select appropriate constants. After you finish displaying Nesbitch Lang's data, change the values and rerun and application.
Output should look like this - before the values are changed: http://imgur.com/Z87aom4 ----------> open this link of image
5 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.

VulpesPosted Feb 4, 2014, 2:21 PM
Anyway, I suggest that you 'pretend' you're in the US by changing the culture of the current thread.
I've also just noticed that the question asks you to use constants so I've dealt with that as well:
VulpesPosted Feb 4, 2014, 2:55 PM
When you have something like {0, 11} it means right justify what's in the first placeholder within a field which is 11 characters wide.
If it had been {0, -11} it would have left justified it within an 11 character wide field.
If you have {0, 11:C} then what's in the first placeholder will (as well as being right justified) be formatted using the 'C' format ('C' stands for currency).
Thousand separators will be added where needed and the number will be formatted with 2 places to the right of the decimal point. It will also be preceded by the currency symbol for the current culture.
SUNIL GUTTAPosted Feb 4, 2014, 2:38 PM
Yes your code is very helpful
11:C ... you mentioned right in console.writeline .. actually whats the use of it ??
I only know i.e {0} {1} ... parameters in console.write so we can replace them accordingly with variables
ex :
int a =24;
string b=male;
console.writeline("my age is {0} and i am {}",a,b);
But you are combining things with something like this
Console.WriteLine("Total Sales: {0, 11:C}", sales);
Thank you .. ..
SUNIL GUTTAPosted Feb 4, 2014, 2:02 PM
VulpesPosted Feb 4, 2014, 1:55 PM