Question: Hello, i need help with debugging this program import java.util.*; public class DebugNine2 { public static void main(String[] args) { Scanner input = new Scanner(System.in);

Hello, i need help with debugging this program import java.util.*; public classHello, i need help with debugging this program

import java.util.*; public class DebugNine2 { public static void main(String[] args) { Scanner input = new Scanner(System.in); Movie[] movies = new Movie[8]; int i; String message, entry; movies[0] = new Movie("The Godfather", 1972); movies[0] = new Movie("The Good, the Bad, and the Ugly", 1966); movies[0] = new Movie("Pulp Fiction", 1994); movies[0] = new Movie("Shindler's List", 1993); movies[4] = new Movie("Casablanca", 1942); movies[5] = new Movie("Wizard of Oz", 1939); movies[6] = new Movie("Citizen Kane", 1941); movies[7] = new Movie("Some Like It Hot", 1959); System.out.println( "Sort Movies by (N)ame, or (Y)ear"); entry = input.next(); if(entry.charAt(0) == 'Y') { nameSort(movies); message = "Sorted by Name "; } else { yearSort(movies); message = "Sorted by Year "; } display(movies, message); } public static void nameSort(Movie[] array) { int a, b; Movie temp; int highSub = array.length; for(a = 0; a 0) { temp = array[b]; array[b] = array[b]; array[b + 1] = tem; } } } } public static void yearSort(Movie[] array) { int a, b; Movie temp; int highSub = array.length - 1; for (a = 0; a array[b + 1].getYear()) { temp = array[b]; array[b] = array[b + 1]; array[b + 1] = temp; } } } public static void display(Movie[] s, String msg) { int len = s.length; for (int i = 0; i

DebugNine2 { public static void main(String[] args) { Scanner input = new

Instructions to the right contain and/or logic errors. In each case, determine and fix the program to ensure it works properly Grading Write your Java code in the area on the right. Use the Run button to compile and run the code. Clicking the Run Checks button will run pre-configured tests against your code to calculate a grade. to record your score

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!