Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2.2.1 Method to Implement: getNumbers Problem. You are asked to implement a utility method which takes two integer bounds (lower and upper) and returns a

image text in transcribed

2.2.1 Method to Implement: getNumbers Problem. You are asked to implement a utility method which takes two integer bounds (lower and upper) and returns a string consisting of all numbers between the two bounds, inclusively. Requirement. It is strictly forbidden for you to use arrays or any library class (e.g., ArrayList). Violating this requirement will cause a 50% penalty on your lab marks. Testing. Your goal is to pass all tests related to this method in the JUnit test class TestUtilities. These tests document the expected values on various cases: study them while developing your code. However, use the console application class Get SequenceApp if you wish (e.g., use the input and expected values from the JUnit tests). Here are two example runs: Enter an integer lower bound: 88 Enter an integer upper bound: 88 1 number between 88 and 88: . Enter an integer lower bound: 23 Enter an integer upper bound: 28 6 numbers between 23 and 28: Todo. Implement the Utilities.getNumbers method. See the comments there for the input parameters and requirements. The String return value must conform to the expected format: There are two possible errors: 1) when not both bounds are non-negative ( 0); and 2) when the lower bound is not less than or equal to the upper bound. What if both error conditions hold simultaneously (e.g., lower 5 and upper - 3, lower -3 and upper -5)? In this case, error condition 1) takes the priority. That is, error condition 2) should only be checked when condition 1) is not the case (i.e., both bounds are non-negative). See the JUnit tests. Notice that the second word in the output may be either singular (number) or plural (numbers, when there are more than one numbers in the sequence). Each number in the sequence is wrapped differently: wrapped by round parentheses if the number is a multiple of 3 (e.g., (24)); wrapped by square brackets if the number is some multiple of 3 plus one (e.g., [25]); and wrapped by a pair of curly braces if the number is some multiple of 3 plus two (e.g., {26}). All wrapped numbers are separated by commas (,). There is one space after each comma

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

Students also viewed these Databases questions

Question

How would you describe your typical day at work?

Answered: 1 week ago

Question

2. Write two or three of your greatest weaknesses.

Answered: 1 week ago