Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I'm working on my comp sci project and when running the JUnit tests, this portion of my code fails in returning the movies that have

I'm working on my comp sci project and when running the JUnit tests, this portion of my code fails in returning the movies that have the same genre. Is there anything that you can notice is wrong in my code? Thanks.

image text in transcribed

/This method returns an array that contains only Movie objects whose *genre matches the targetGenre passed in *The array returned does not contain any NULL values *This method returns an array of length e if there are no matches *This method may call the getOnlyItems method public Movie[] findMoviesByGenre(String targetGenre)t Movie[ ]result; int count 0; Movie[]movieGenres -getOnlyItems (movies, numMovies); for(Movie movieGenre:movieGenres) if(movieGenre.getGenre().equals(targetGenre)) count++; result -new Movie[count]; int i 0; for(Movie movieGenre:movieGenres)t if(movieGenre.getGenre() .equals (targetGenre)) result[i]movieGenre; return result

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_2

Step: 3

blur-text-image_3

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

Linked Data A Geographic Perspective

Authors: Glen Hart, Catherine Dolbear

1st Edition

1000218910, 9781000218916

More Books

Students also viewed these Databases questions

Question

What are the key differences between the major data mining methods?

Answered: 1 week ago

Question

LO4 Identify a system for controlling absenteeism.

Answered: 1 week ago

Question

What is topology? Explain with examples

Answered: 1 week ago

Question

What is Change Control and how does it operate?

Answered: 1 week ago

Question

How do Data Requirements relate to Functional Requirements?

Answered: 1 week ago