Question: Task 2 [Note: To do Task 2, you have to download Task2.java file from NAIL from the TCA2 folder] The purpose of the Java class

 Task 2 [Note: To do Task 2, you have to download
Task2.java file from NAIL from the TCA2 folder] The purpose of the
Java class "Task2" is to displays the title of all records in

Task 2 [Note: To do Task 2, you have to download Task2.java file from NAIL from the TCA2 folder] The purpose of the Java class "Task2" is to displays the title of all records in the album table which costs more than 5.99. However, one of the methods public static ArrayList getTitles (double budget) is incomplete. The method getTitles takes a budget (type double) as input. It then queries the database by calling executeThisQuery method and stores the result in a ResultSet. Each record in the ResultSet is then added in an ArrayList. The method getTitles retums ArrayList at the end. You need ONLY to complete the implementation of the method public static ArrayList getTitles (double budget) [In the answers' document you must include a screenshot from your IDE showing the output) [25 marks main getTitles main C 7.java module-info.class X blic class main { module-info.java (com.example.csy2030) X hello-vie 1 A 6X4 private static Connection con; * This method returns an ArrayList that contains titles of all * album table with price greater than 5.99 */ public static ArrayList getTitles(double budget) { [/write missing code here //This method return executes a query and return a ResultSet public static ResultSet executeThisQuery(String query) { ResultSet rset = null; try { Statement stmt = con.createStatement(); 3 4 ZA/en/main/java/com/example/csy2030/main. 7 TI sy2030 - main.java getTitles main module-info.class X module-info.java (com.example.csy2030) X hel 1 A6 [/This method return executes a query and return a Resu public static ResultSet executeThisQuery(String query) { ResultSet rset = null; try { Statement stmt = con.createStatement(); rset = stmt.executeQuery(query); } catch (SQLException e) { e.printStackTrace(); } return rset; } //This method return establishes a DB connection & return public static boolean establishDBConnection() { // Update the following with your postgres id and pass String USER_Name = String PASSWORD = ""; try {

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!