Sha256: 4b138ac82624a1de2e4ab239693937cb177247c68087219cfc820eb4753d161d

Contents?: true

Size: 726 Bytes

Versions: 115

Compression:

Stored size: 726 Bytes

Contents

public class Bob
{
    public static string Hey(string statement)
    {
        if (IsSilence(statement))
            return "Fine. Be that way!";
        if (IsYelling(statement))
            return "Whoa, chill out!";
        if (IsQuestion(statement))
            return "Sure.";
        return "Whatever.";
    }

    private static bool IsSilence (string statement)
    {
        return statement.Trim() == "";
    }

    private static bool IsYelling (string statement)
    {
        return statement.ToUpper() == statement && System.Text.RegularExpressions.Regex.IsMatch(statement, "[a-zA-Z]+");
    }

    private static bool IsQuestion (string statement)
    {
        return statement.Trim().EndsWith("?");
    }

}

Version data entries

115 entries across 115 versions & 1 rubygems

Version Path
trackler-2.0.6.19 tracks/csharp/exercises/bob/Example.cs
trackler-2.0.6.18 tracks/csharp/exercises/bob/Example.cs
trackler-2.0.6.17 tracks/csharp/exercises/bob/Example.cs
trackler-2.0.6.16 tracks/csharp/exercises/bob/Example.cs
trackler-2.0.6.15 tracks/csharp/exercises/bob/Example.cs
trackler-2.0.6.14 tracks/csharp/exercises/bob/Example.cs
trackler-2.0.6.13 tracks/csharp/exercises/bob/Example.cs
trackler-2.0.6.12 tracks/csharp/exercises/bob/Example.cs
trackler-2.0.6.11 tracks/csharp/exercises/bob/Example.cs
trackler-2.0.6.10 tracks/csharp/exercises/bob/Example.cs
trackler-2.0.6.9 tracks/csharp/exercises/bob/Example.cs
trackler-2.0.6.8 tracks/csharp/exercises/bob/Example.cs
trackler-2.0.6.7 tracks/csharp/exercises/bob/Example.cs
trackler-2.0.6.6 tracks/csharp/exercises/bob/Example.cs
trackler-2.0.6.5 tracks/csharp/exercises/bob/Example.cs
trackler-2.0.6.4 tracks/csharp/exercises/bob/Example.cs
trackler-2.0.6.3 tracks/csharp/exercises/bob/Example.cs
trackler-2.0.6.2 tracks/csharp/exercises/bob/Example.cs
trackler-2.0.6.1 tracks/csharp/exercises/bob/Example.cs
trackler-2.0.6.0 tracks/csharp/exercises/bob/Example.cs