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.39 tracks/csharp/exercises/bob/Example.cs
trackler-2.0.6.38 tracks/csharp/exercises/bob/Example.cs
trackler-2.0.6.37 tracks/csharp/exercises/bob/Example.cs
trackler-2.0.6.36 tracks/csharp/exercises/bob/Example.cs
trackler-2.0.6.35 tracks/csharp/exercises/bob/Example.cs
trackler-2.0.6.34 tracks/csharp/exercises/bob/Example.cs
trackler-2.0.6.33 tracks/csharp/exercises/bob/Example.cs
trackler-2.0.6.32 tracks/csharp/exercises/bob/Example.cs
trackler-2.0.6.31 tracks/csharp/exercises/bob/Example.cs
trackler-2.0.6.30 tracks/csharp/exercises/bob/Example.cs
trackler-2.0.6.29 tracks/csharp/exercises/bob/Example.cs
trackler-2.0.6.28 tracks/csharp/exercises/bob/Example.cs
trackler-2.0.6.27 tracks/csharp/exercises/bob/Example.cs
trackler-2.0.6.26 tracks/csharp/exercises/bob/Example.cs
trackler-2.0.6.25 tracks/csharp/exercises/bob/Example.cs
trackler-2.0.6.24 tracks/csharp/exercises/bob/Example.cs
trackler-2.0.6.23 tracks/csharp/exercises/bob/Example.cs
trackler-2.0.6.22 tracks/csharp/exercises/bob/Example.cs
trackler-2.0.6.21 tracks/csharp/exercises/bob/Example.cs
trackler-2.0.6.20 tracks/csharp/exercises/bob/Example.cs