Bob

in ita •  22 days ago 

using System;
using System.Text.RegularExpressions;

public static class Bob
{
public static string Response(string statement)
{
string statementmod= statement.Trim();
bool isQuestion = statementmod.EndsWith("?");
int letterCounter = Regex.Matches(statementmod,@"[a-zA-Z]").Count;
bool hasLetter = letterCounter>0;
bool hasOnlyUpper = statementmod==statementmod.ToUpper();

    if (statementmod=="")
    {
        return "Fine. Be that way!";
    }

    else if(isQuestion && hasOnlyUpper && hasLetter)
    {
        return "Calm down, I know what I'm doing!";
    }

    else if(isQuestion)
    {
        return "Sure.";
    }
    else if(hasLetter && hasOnlyUpper)
    {
        return "Whoa, chill out!";
    }
  else return "Whatever."; 
}

}

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!