@Test public void test_00_compressString() { String inputStr = "bbbcfreb$b"; String expected = "b3c1f1rlelbl$1b1"; Strin

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

@Test public void test_00_compressString() { String inputStr = "bbbcfreb$b"; String expected = "b3c1f1rlelbl$1b1"; Strin

Post by answerhappygod »

Test Public Void Test 00 Compressstring String Inputstr Bbbcfreb B String Expected B3c1f1rlelbl 1b1 Strin 1
Test Public Void Test 00 Compressstring String Inputstr Bbbcfreb B String Expected B3c1f1rlelbl 1b1 Strin 1 (208.54 KiB) Viewed 23 times
In Java,
Please do the implementation below the where that wrote "Yourimplementation" and write the same class as the pictures donot change anything thanks and there's information below classabout what you should write thanks and that's the Junit testproject all of the task should be pass thanks and please provideyour screen shot of your code that all of the task are passed withthe my junit test that i provided for you
@Test public void test_00_compressString() { String inputStr = "bbbcfreb$b"; String expected = "b3c1f1rlelbl$1b1"; String result = StringUtility.compressString (inputStr); String error = String.format("error on compressString, expected %s, but returned %s", expected, result); assertTrue (error, expected.equals(result)); } @Test public void test_01_compressString() } String inputStr = "bbbcffffreb$b"; String expected = "b3c1f4r1e1b1$1b1"; String result StringUtility.compressString (inputStr); String error = String.format("error on compressString, expected %s, but returned %s", expected, result); assertTrue (error, expected.equals(result)); } @Test public void test_02_compressString() { String inputStr = String expected = String result = StringUtility.compressString (inputStr); String error = String.format("error on compressString, expected %s, but returned %s", expected, result); "SHOWSHOWSHOWSHOWCASECASE"; "S1H101W1S1H101W1S1H101W1S1H101W1C1A1S1E1C1A1S1E1";
/** * <p> Write a compressString method that * compression long String {@code str} that contain many adjacent equal characters * (but no digits). * <p> For example: </p> * * * * compressString("") return "" * compressString("bbbcfreb$b") * compressString("bbbrrraaaaaazzzz") * * </pre> * <pre> * * @param inputStr : * * @pre.. * , empty string return "b3c1flrlelbl$1b1" return "b3r3a6z4" string to be compressed, {@code str} is not null Precondition: s does not contain a digit in '0'.. '9¹. the compressed version of long string as explained above * @return * * * * * */ public static String compressString (String inputStr) { /* Your implementation of this method starts here. * Recall that : * 1. No System.out.println statements should appear here. * Instead, you need to return the result. * 2. No Scanner operations should appear here (e.g., input.nextInt()). Instead, refer to the input parameters of this method. * */
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply