Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

d1b10bmlvqabco.cloudfront.net COMP 1406 Class Pro.. COMP 1406 (298 unrea.. Get Homework Help Wi... Computer Science que In This Problem, You Wi * Greturn true if

image text in transcribedimage text in transcribedimage text in transcribed

d1b10bmlvqabco.cloudfront.net COMP 1406 Class Pro.. COMP 1406 (298 unrea.. Get Homework Help Wi... Computer Science que In This Problem, You Wi * Greturn true if the current grades are sufficient for a student to enroll in second year SCS coding course; returns false otherwise. The rule for this can be found in the course outline public boolean canProgressTo2ndYear Of...h 3 Find/FindAgain 20 marks In this problem, you will be creating black-box test cases for the static methods in the Find and FindAgain classes from Assignment 1. For this assignment, howver, both methods (locateSequence ) and locateAllSequenceLocations)) will be in a modified Find class to simplify things. The API for the two methods is shown later in this document You will complete the makeTestCases method in the TestFind class. Generate test cases for the (modified) Find class *Oreturn an array of test cases for the (modified) Find class public static FindTestCase makeTestCases )... Each of the FindTestCase objects is a test case for both methods. A test case will consist of a target sequence, an array and the expected output for both methods. A test case is valid if it is correct for both methods. All valid test cases will be used to try and expose bugs in various implementations of each of the methods. Test cases that are invalid will be discarded. COMP1406 Winter 2019 Find.java x FindTestCase java Grades java Grades TestCase java FutureDate TestCase java TestFutureDate javaTestGrades java Date java 1 package comp1486a3; 3 public class Find Finds the last occurrence of the target sequence in the array or * indicates that the target sequence is not present. @param target is an array of one or more integers It is the target sequence we are Looking for. 10 11 eparam array is an array of zero or more integers. @return the starting index position of the last occurrence of the target sequence in the array if it exists Returns-1 otherwise 14 17 public static int locateSequence(int target, int] array) 18 19 2e 21 22 Finds ALL occurrences of the target sequence in the array and 23 24 25 26 return -777 returns an array indicating how many times the target sequence appeared *in the array and alt of their starting position (in increas ing order). eparam target is an array of one or more integers. 27It is the target sequence we are Looking for 28 29 aparam array is an array of zero or more integers @return an array of integers of size at least one. The first element 32 in the array is the number of times the target sequence was found in the array. The next elements, if any, are the starting index positions of each occurrence of the target sequence in the array listed in increasing order. The returned array should be big enough to hold this data and not any larger 36 37 38 39 public static intl LocateAl1Sequencelocations(int!1 target, int array) return null; 41 Ln 1, Col 1 Spaces: 2 UTF-8 CRLF Java d Find.java FindTestCase.java x GradesTestCase. java 1 TestFutureDate. java ,(TestGradesjava em." Date java 1 package comp1486a3; 3 public class FindTestCasef Grades.java FutureDateTestCase.java intl target; int[] array; int expectedFind; intl1 expectedF indAgain public int[1 getTargetf return this.target; 11 public int[l getArray)f return this.array; 12 public int getExpFind return this.expectedFind; 13 public intl getExpFindAgain()f return this.expectedFindAgain; 14 15 A test case for both the 16 17 18 19 2e @param target is the target sequence It is an array of one or more integers * @param array is an array of zero or nore integers 21 eparam expectedFind is the expected output of Find.LocateSequence(target, array) t @param expectedFindAgain is the expected output of 23 24 25 public FindTestCase(int 1 target, intI1 array, 26 Find. LocateAllSequenceLocations(target.array) int expectedFind, int I] expectedFindAgain) 28 29 3e this.targettarget; this.arrayarray; this.expectedFind-expectedFind; this.expectedFindAgain expectedFindAgain; 32 34 n 1, Col 1 Tab Size: 2 uTF-8 CRLF Java g d1b10bmlvqabco.cloudfront.net COMP 1406 Class Pro.. COMP 1406 (298 unrea.. Get Homework Help Wi... Computer Science que In This Problem, You Wi * Greturn true if the current grades are sufficient for a student to enroll in second year SCS coding course; returns false otherwise. The rule for this can be found in the course outline public boolean canProgressTo2ndYear Of...h 3 Find/FindAgain 20 marks In this problem, you will be creating black-box test cases for the static methods in the Find and FindAgain classes from Assignment 1. For this assignment, howver, both methods (locateSequence ) and locateAllSequenceLocations)) will be in a modified Find class to simplify things. The API for the two methods is shown later in this document You will complete the makeTestCases method in the TestFind class. Generate test cases for the (modified) Find class *Oreturn an array of test cases for the (modified) Find class public static FindTestCase makeTestCases )... Each of the FindTestCase objects is a test case for both methods. A test case will consist of a target sequence, an array and the expected output for both methods. A test case is valid if it is correct for both methods. All valid test cases will be used to try and expose bugs in various implementations of each of the methods. Test cases that are invalid will be discarded. COMP1406 Winter 2019 Find.java x FindTestCase java Grades java Grades TestCase java FutureDate TestCase java TestFutureDate javaTestGrades java Date java 1 package comp1486a3; 3 public class Find Finds the last occurrence of the target sequence in the array or * indicates that the target sequence is not present. @param target is an array of one or more integers It is the target sequence we are Looking for. 10 11 eparam array is an array of zero or more integers. @return the starting index position of the last occurrence of the target sequence in the array if it exists Returns-1 otherwise 14 17 public static int locateSequence(int target, int] array) 18 19 2e 21 22 Finds ALL occurrences of the target sequence in the array and 23 24 25 26 return -777 returns an array indicating how many times the target sequence appeared *in the array and alt of their starting position (in increas ing order). eparam target is an array of one or more integers. 27It is the target sequence we are Looking for 28 29 aparam array is an array of zero or more integers @return an array of integers of size at least one. The first element 32 in the array is the number of times the target sequence was found in the array. The next elements, if any, are the starting index positions of each occurrence of the target sequence in the array listed in increasing order. The returned array should be big enough to hold this data and not any larger 36 37 38 39 public static intl LocateAl1Sequencelocations(int!1 target, int array) return null; 41 Ln 1, Col 1 Spaces: 2 UTF-8 CRLF Java d Find.java FindTestCase.java x GradesTestCase. java 1 TestFutureDate. java ,(TestGradesjava em." Date java 1 package comp1486a3; 3 public class FindTestCasef Grades.java FutureDateTestCase.java intl target; int[] array; int expectedFind; intl1 expectedF indAgain public int[1 getTargetf return this.target; 11 public int[l getArray)f return this.array; 12 public int getExpFind return this.expectedFind; 13 public intl getExpFindAgain()f return this.expectedFindAgain; 14 15 A test case for both the 16 17 18 19 2e @param target is the target sequence It is an array of one or more integers * @param array is an array of zero or nore integers 21 eparam expectedFind is the expected output of Find.LocateSequence(target, array) t @param expectedFindAgain is the expected output of 23 24 25 public FindTestCase(int 1 target, intI1 array, 26 Find. LocateAllSequenceLocations(target.array) int expectedFind, int I] expectedFindAgain) 28 29 3e this.targettarget; this.arrayarray; this.expectedFind-expectedFind; this.expectedFindAgain expectedFindAgain; 32 34 n 1, Col 1 Tab Size: 2 uTF-8 CRLF Java g

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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