Commit 48ed950f authored by jackt's avatar jackt

Complete Part 2.1

parent cb987464
Pipeline #343 failed with stages
...@@ -19,42 +19,43 @@ public class AssessmentPartTwo { ...@@ -19,42 +19,43 @@ public class AssessmentPartTwo {
char aChar = aWord.charAt(length); // selects the letter at the current char placement char aChar = aWord.charAt(length); // selects the letter at the current char placement
Character.toString(aChar); // converts the char to a string value Character.toString(aChar); // converts the char to a string value
Character.toLowerCase(aChar); // converts all inputs to lowercase to make sure they match
switch (String.valueOf(aChar)) { // switch statement to allow for loop to select the correct string and add the corresponding value switch (String.valueOf(aChar)) { // switch statement to allow for loop to select the correct string and add the corresponding value
case "a": case "A": case "e": case "E": case "i": case "I": case "o": case "O": case "n": case "N": case "a": case "e": case "i": case "o": case "n": case "r": case "t": case "l": case "s": case "u":
case "r": case "R": case "t": case "T": case "l": case "L": case "s": case "S": case "u": case "U":
total = total + 1; total = total + 1;
break; break;
case "d": case "D": case "g": case "G": case "d": case "g":
total = total + 2; total = total + 2;
break; break;
case "b": case "B": case "c": case "C": case "m": case "M": case "p": case "P": case "b": case "c": case "m": case "p":
total = total + 3; total = total + 3;
break; break;
case "f": case "F": case "h": case "H": case "v": case "V": case "w": case "W": case "y": case "Y": case "f": case "h": case "v": case "w": case "y":
total = total + 4; total = total + 4;
break; break;
case "k":case "K": case "k":
total = total + 5; total = total + 5;
break; break;
case "j": case "J": case "x": case "X": case "j": case "x":
total = total + 8; total = total + 8;
break; break;
case "q": case "Q": case "z": case "Z": case "q": case "z":
total = total + 10; total = total + 10;
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment