Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider the following Java code segment: public Hashtable countAlphabet(String aString){ Hashtable table = new Hashtable(); If (aString.length > 4000) return table; StringBuffer buffer = new

Consider the following Java code segment:

public Hashtable countAlphabet(String aString){

Hashtable table = new Hashtable();

If (aString.length > 4000) return table;

StringBuffer buffer = new StringBuffer(aString);

While (buffer.length() > 0){

String firstChar = buffer.substring(0, 1);

Integer count = (Integer)table.get(firstChar);

if (count == null){

count = new Integer(1); }

else{

count = new Integer(count.intValue() + 1);

}

table.put(firstChar, count);

buffer.delete(0, 1);

}

return table;

}

The program counts the numbers of each alphabet in a string, and put the result in a hashtable. Develop a minimum set of test cases that:

1. Guarantees that all independent execution path is exercised at least once;

2. Guarantees that both the true and false side of all logical decisions are exercised;

3. Executes the loop at the boundary values and within the boundaries.

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

Database Modeling And Design

Authors: Toby J. Teorey, Sam S. Lightstone, Tom Nadeau, H.V. Jagadish

5th Edition

0123820200, 978-0123820204

More Books

Students also viewed these Databases questions

Question

=+Are you interested in working on global teams?

Answered: 1 week ago

Question

The paleolithic age human life, short write up ?

Answered: 1 week ago