public override AnswerMessage GetSolution(long first, long second) { if (Sen.Contains(second)) { switch (second) { case 7: { var solution = $"{first} - {second} = {first} - {Ten} + 3 = "; return(new AnswerMessage(AppResources.Minus7Message, solution)); } case 8: { var solution = $"{first} - {second} = {first} - {Ten} + 2 = "; return(new AnswerMessage(AppResources.Minus8Message, solution)); } case 9: { var solution = $"{first} - {second} = {first} - {Ten} + 1 = "; return(new AnswerMessage(AppResources.Minus9Message, solution)); } default: return(null); } } if (second > 10) { return(GetMultiDigitSolution(first, second)); } return(null); }
public override AnswerMessage GetSolution(long first, long second) { if (first + second <= Ten) { return(null); } if (Sen.Contains(first) && (first + second) % 10 != 0) { switch (first) { case 7: { var solution = $"{first} + {second} = {Ten} + {second} - 3 = "; return(new AnswerMessage(AppResources.Plus_7_8_9_Message, solution)); } case 8: { var solution = $"{first} + {second} = {Ten} + {second} - 2 = "; return(new AnswerMessage(AppResources.Plus_7_8_9_Message, solution)); } case 9: { var solution = $"{first} + {second} = {Ten} + {second} - 1 = "; return(new AnswerMessage(AppResources.Plus_7_8_9_Message, solution)); } default: return(null); } } if (Sen.Contains(second) && (first + second) % 10 != 0) { switch (second) { case 7: { var solution = $"{first} + {second} = {first} + {Ten} - 3 = "; return(new AnswerMessage(AppResources.Plus_7_8_9_Message, solution)); } case 8: { var solution = $"{first} + {second} = {first} + {Ten} - 2 = "; return(new AnswerMessage(AppResources.Plus_7_8_9_Message, solution)); } case 9: { var solution = $"{first} + {second} = {first} + {Ten} - 1 = "; return(new AnswerMessage(AppResources.Plus_7_8_9_Message, solution)); } default: return(null); } } if (first + second > 10 && second < 10) { var answer = first + second; var withTransition = first / 10 < answer / 10; if (answer > 10 && withTransition && answer % 10 != 0) { var x = answer / 10 * 10; var secondOne = x - first; var secondTwo = answer - x; var solution = $"{first} + {second} = {first} + {secondOne} + {secondTwo} = "; return(new AnswerMessage(AppResources.Addition1To20Rule, solution)); } return(null); } if (first > 10 && second > 10) { return(GetMultiDigitSolution(first, second)); } return(null); }