Click here to Skip to main content
15,919,422 members
Home / Discussions / C#
   

C#

 
AnswerRe: C# help? Pin
PIEBALDconsult15-Dec-11 6:36
mvePIEBALDconsult15-Dec-11 6:36 
AnswerRe: C# help? Pin
Deborah Palmer McCain15-Dec-11 8:34
Deborah Palmer McCain15-Dec-11 8:34 
GeneralRe: C# help? Pin
Richard MacCutchan15-Dec-11 22:23
mveRichard MacCutchan15-Dec-11 22:23 
GeneralRe: C# help? Pin
Deborah Palmer McCain16-Dec-11 6:35
Deborah Palmer McCain16-Dec-11 6:35 
AnswerRe: C# help? PinPopular
DaveyM6915-Dec-11 9:25
professionalDaveyM6915-Dec-11 9:25 
GeneralRe: C# help? Pin
Luc Pattyn15-Dec-11 19:59
sitebuilderLuc Pattyn15-Dec-11 19:59 
AnswerRe: C# help? Pin
gymmy15-Dec-11 12:31
gymmy15-Dec-11 12:31 
AnswerRe: C# help? Pin
DaveyM6915-Dec-11 13:18
professionalDaveyM6915-Dec-11 13:18 
OK, you've had a bit of time to fix your errors and enough hints...

Here is working code with
a) reduntant items removed
b) code styling and variable/method names changed where appropriate
c) other suggestions applied
d) the double array moved outside of the method - unless it's going to be different every time (as it's hardcoded I assume not) then it makes no sense to keep it there

Study it and the differences and see if you can learn from it:

C#
private static readonly double[] PayRate =
    new double[4] {
        3.00,
        4.15,
        6.42,
        7.95 };

static void Main()
{
    Console.WriteLine("Enter your forename:");
    string forename = Console.ReadLine();
    Console.WriteLine("Enter your surname:");
    string surname = Console.ReadLine();
    Checkout();
    Console.ReadKey();
}

private static void Checkout()
{
    Console.WriteLine("You are ready to check out.");
    for (int i = 0; i < PayRate.Length; i++)
        Console.WriteLine("Pay rate {0} is {1:C}", i, PayRate[i]);
}

Dave

Binging is like googling, it just feels dirtier.
Please take your VB.NET out of our nice case sensitive forum.
Astonish us. Be exceptional. (Pete O'Hanlon)

BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)



QuestionC# question? Pin
Brian Reiber15-Dec-11 5:14
Brian Reiber15-Dec-11 5:14 
AnswerRe: C# question? Pin
DaveyM6915-Dec-11 5:32
professionalDaveyM6915-Dec-11 5:32 
AnswerRe: C# question? PinPopular
Pete O'Hanlon15-Dec-11 5:37
mvePete O'Hanlon15-Dec-11 5:37 
GeneralRe: C# question? Pin
harold aptroot15-Dec-11 6:22
harold aptroot15-Dec-11 6:22 
QuestionWindows 7: Automatic file delete? Pin
Paladin200015-Dec-11 4:52
Paladin200015-Dec-11 4:52 
QuestionThread Abort Exception Pin
anishkannan15-Dec-11 0:27
anishkannan15-Dec-11 0:27 
AnswerRe: Thread Abort Exception Pin
BobJanova15-Dec-11 22:32
BobJanova15-Dec-11 22:32 
GeneralRe: Thread Abort Exception Pin
anishkannan15-Dec-11 22:54
anishkannan15-Dec-11 22:54 
QuestionCreate a licence file. Pin
Jitendra Parida - Jeetu15-Dec-11 0:03
Jitendra Parida - Jeetu15-Dec-11 0:03 
QuestionReplace File Only If Newer (Deployment) Pin
PDaniels3314-Dec-11 23:28
PDaniels3314-Dec-11 23:28 
AnswerRe: Replace File Only If Newer (Deployment) Pin
Not Active15-Dec-11 0:25
mentorNot Active15-Dec-11 0:25 
QuestionHow to find coordinates of each word in pdf file using iTextSharp Pin
NarVish14-Dec-11 23:18
NarVish14-Dec-11 23:18 
QuestionMake a sql query object by C#. Pin
Vincet Shen14-Dec-11 17:05
Vincet Shen14-Dec-11 17:05 
AnswerRe: Make a sql query object by C#. Pin
OriginalGriff14-Dec-11 21:35
mveOriginalGriff14-Dec-11 21:35 
GeneralRe: Make a sql query object by C#. Pin
Vincet Shen15-Dec-11 22:11
Vincet Shen15-Dec-11 22:11 
QuestionEvent Handler for button clicks Pin
Miwin Solutions14-Dec-11 7:43
Miwin Solutions14-Dec-11 7:43 
AnswerRe: Event Handler for button clicks Pin
Luc Pattyn14-Dec-11 8:28
sitebuilderLuc Pattyn14-Dec-11 8:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.