Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The purpose of this quiz is to ensure that you can run tests write tests identify bugs using tests fix the bugs Instructions: Create a

The purpose of this quiz is to ensure that you can
run tests
write tests
identify bugs using tests
fix the bugs
Instructions:
Create a project named IST311LifeCycleQuiz;
Implement the classes identified below;
Export the project to a zip file (This is in the menu for IntelliJ at File->Export to Zip file...)
Code Specification:
We are solving a classic interview problem, finding the longest prefix in an ArrayList of Strings. These types of problems feature heavily in interviews, and String manipulation is a common practice that you will need to master to be an effective developer. The problem statement is:
You must find the longest common prefix in an array of Strings. If there is no common prefix, return an empty string (i.e. ""). If there is a common prefix, return it as a String:
Example: in this array ["flower","flow","flight"], we would return "fl"Example: in this array ["flower","flow"], we would return "flow"Example: in this array ["dog","racecar","car"], we would return ""Example: in this array [], we would return "" as there are no strings at all
Step 1:
Below are two classes LongestCommonPrefix and LongestCommonPrefixTest. Create the corresponding java files (they must have the same name), and ensure that you can run your tests.
Step 2:
Write a new test where you pass an empty ArrayList to the findLongestCommonPrefix method. This test will fail, in fact, it will through an error. You need to figure out how to fix this, hint, it should return an empty string ("") if there are no elements in the ArrayList. Include at least one assert in the test.
Step 3:
Find a way to fix the code so that the test passes.
Step 4 (Extra Credit):
Write another test that would fail given the code below and correct the code so that it passes, this must include at least assert in the test.
Step 5:
Zip up the project and turn it in.

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

Microsoft Visual Basic 2008 Comprehensive Concepts And Techniques

Authors: Gary B. Shelly, Corinne Hoisington

1st Edition

1423927168, 978-1423927167

More Books

Students also viewed these Databases questions