Because of the Swedish Chef’s strong accent, Kermit and the other Muppets have a
ID: 3604179 • Letter: B
Question
Because of the Swedish Chef’s strong accent, Kermit and the other Muppets have a very difficult time understanding him. Write a Java program that converts English to Swedish-accented English. Do this by replacing substrings in sentences with other substrings. In the table below, the left column shows the original English substring and the right column shows what it should be converted into (ignore all quotation marks). Note when applying substitutions, you should scan the input line from left to right trying the rules in the table from top to bottom at each character of the input line. Anything that does not match one of these rules should be left alone in the output. Furthermore, make sure that you neither apply a rule to text that is the output from the application of another rule nor overlap matching substrings. For example, "ue" should generate "oo" and not "ooey". Input from the keyboard the multiple lines of text to translate. Output will be the Swedish-accented English translation of each line of the input.
Refer to the sample output below.
Sample Run:
Enter the text: The judges think you will find the problem set both fun and challenging. We hope you actually do.
Translation: Der judges dink yoo vill findy der problem set bod fun und challenging. Vey hopey yoo actually do.
Name the program: SwedishChefXX.java, where XX are your initials.
aii yyyy" yyrr 00: " ddeeeessiiExplanation / Answer
using System; using System.IO; using System.Collections; using System.Linq; class program { public static void Main(string[] args) { var t = typeof(IEnumerable); var typesIEnum = AppDomain.CurrentDomain.GetAssemblies().SelectMany(x => x.GetTypes()).Where(x => t.IsAssignableFrom(x)); foreach (var types in typesIEnum) { Console.WriteLine(types.FullName); } Console.ReadLine(); } }