Write a program ReplaceTester that encodes a string by replacing all letters "i" with "!" and all letters "s" with "$". Use the replace method. Demonstrate that you can correctly encode the string "Mississippi". Print both the actual and expected result.
1
Expert's answer
2013-07-23T07:44:57-0400
Source:
public class ReplaceTester { public static void main(String[] args){ String input = "Missiissippi"; String result = input.replaceAll("i", "!"); result = result.replaceAll("s", "\$"); System.out.println("Expected result: M!$$!!$$!pp!"); System.out.println("Actual result: "+result); } }
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments
Leave a comment