I am a student taking my first programing class, so any help is really appreciated. I have tried everything I know how to do which isn't much so the solution could be really obvious for someone who knows what they are doing.
I am tiring to display the following code. To look like this:
Employee information obtained by properties and methods:
First name is Sue Last name is Jones Social security number is 222-22-2222 Gross sales are $10,000.00 Commission rate is 0.06 Earnings are $600.00 Updated employee information obtained by ToString:
commission employee: Sue Jones social security number: 222-22-2222 gross sales: $5,000.00 commission rate: 0.10 earnings: $500.00
But the closest I can get is:
Employee information obtained by properties and methods: First name is Sue Last name is Jones Social security number is 222-22-2222 Gross sales are 10000.00 Commission rate is 0.06 Earnings are 600.0000
Nilanka DharmadasaRank #1,875 · 794 reputationPosted Nov 22, 2009, 5:45 PM EST
You can use this way. It will help you to get your expected result.
String.Format("{0} ${1}", "Gross sales are", employee.GrossSales.ToString("###,###,###,##0.00") + "\r\n") +
String.Format("{0} ${1}", "Earnings are", employee.Earnings().ToString("###,###,###,##0.00") + "\r\n");
If you find this useful, please mark 'Do you like this answer' checkbox.
Pravakar Jaiswal6 reputationPosted Nov 23, 2009, 6:28 PM EST
String.Format("{0} ${1}", "Earnings are", employee.Earnings().ToString("N2") + "\r\n");
N2-> two decimal point display patteren.
you can change 2 with required decimal point dispaly pattern.