Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please use Java Script! PP In this programming exercise, we are going to add a few methods to DVD example covered in the class. In

Please use Java Script! PP In this programming exercise, we are going to add a few methods to DVD example covered in the class.

In the DVD class, add a getter method getTitle to return the title of DVD.

In the DVDCollection class, add a method findDVD to search a particular DVD title searchTitle. If searchTitle matches the title of a DVD in the collection, return its index value in the DVD array; otherwise return -1.

In the Movies class, add the following three statements at the end of the main method.

System.out.println("Iron Man is at index " + movies.findDVD("Iron Man"));

System.out.println("Iron Man 2 is at index " + movies.findDVD("Iron Man 2"));

System.out.println("Iron Man 3 is at index " + movies.findDVD("Iron Man 3"));

If your implementation is correct, you should expect to see the following output.

Hint: Use a for loop to go through the DVD array to look for the searchTitle. You may find the String method equals useful to compare the contents of two strings s1 and s2: s1.equals(s2). This exercise is very useful for your individual assignment 3.

Iron Man is at index 2

Iron Man 2 is at index 5

Iron Man 3 is at index -1

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

1 2 3 Data Base Techniques

Authors: Dick Andersen

1st Edition

0880223464, 978-0880223461

More Books

Students also viewed these Databases questions

Question

Explain the DELTA framework.

Answered: 1 week ago