Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Coverage: Write exactly four test cases and indicate which lines of code each of them covers. Use the following table as template for your tests.

image text in transcribedCoverage: Write exactly four test cases and indicate which lines of code each of them covers. Use the following table as template for your tests. You are not required to write JUnit test code.

image text in transcribed

3. The Java program compress below takes two parameters: a string s and an integer factor, which indicates how many consecutive occurences of any character c should be compressed in the form on where n is the number of consecutive occurrences of c. The program compresses the input string s by the given compression factor and return the re- sulting compressed string. For example, given the input string "aabbb" and a factor 2, the resulting compressed string will be "a2b3", but it the factor is 3 instead, then the sequence of two a's is not compressed and the resulting string will be "aab3". 1 2. 3 4 5 6 7 8 9 10 11 12 13 14 15 public static String compress (String s, int factor) { if (factor =2"); if (s.length() factor) result += last + String.valueof (count); else result += current; last = c; current = String.valueOf(c); count = 1; ) } if (count >= factor) result += last + String.valueof (count); else result += current; return result; 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 # # S value for s factor Expected Output value for factor expected return value Lines covered e.g., 1-3, 4, 6-9 1 ... 2

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Manga Guide To Databases

Authors: Mana Takahashi, Shoko Azuma, Co Ltd Trend

1st Edition

1593271905, 978-1593271909

More Books

Students also viewed these Databases questions

Question

What do Dimensions represent in OLAP Cubes?

Answered: 1 week ago