Im trying to write a JAVA program that will allow me to input movies.csv and ouput "Wonders of the World | G | 16:40 20:00 End of the Universe | NC-17 | 19:00 Buffalo Bill And The Indians or Sitting Bull | PG | 12:45 15:00 19:30 Adventure of Lewis and Clark | PG-13 | 10:00 14:30 Halloween | R | 19:00". I need help with my code, this is what it looks like now, please let me know how to fix it. import java.io.File; import java.io.FileNotFoundException; import java.util.LinkedHashSet; import java.util.LinkedList; import java.util.Scanner; public class LabProgram { public static void main(String[] args) { // Create LinkedList LinkedList movies = new LinkedList<>(); // Create HashSet LinkedHashSet moviesTitle = new LinkedHashSet<>(); // read file name from user Scanner input = new Scanner(System.in); String fileName = input.next(); try { // create an object of Scanner Scanner file = new Scanner(new File("movies.csv")); // iterate each line in the file while (file.hasNextLine()) { String data = file.nextLine(); movies.add(data); String[] dataArray = data.split(",");// moviesTitle.add(dataArray[1]); } } catch (FileNotFoundException e) { e.printStackTrace(); } // format each line for (String title : moviesTitle) { // print title System.out.printf("%s", title); String time = " | "; String ratings = " | "; for (String movie : movies) { String[] dataArray = movie.split(","); if (title.equals(dataArray[1])) { time = time + dataArray[0] + " "; ratings = ratings + dataArray[2] + ","; } } // print ratings System.out.printf("%s", ratings.substring(0, ratings.length() - 1)); // print times System.out.printf("%s", time.substring(0, time.length() - 1)); // print vertical bar System.out.println(); } } }   Thr first image attatched shows what its supposed to look like and the 2nd image shows what it looks like when I try to run

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Im trying to write a JAVA program that will allow me to input movies.csv and ouput "Wonders of the World | G | 16:40 20:00 End of the Universe | NC-17 | 19:00 Buffalo Bill And The Indians or Sitting Bull | PG | 12:45 15:00 19:30 Adventure of Lewis and Clark | PG-13 | 10:00 14:30 Halloween | R | 19:00".

I need help with my code, this is what it looks like now, please let me know how to fix it.

import java.io.File;
import java.io.FileNotFoundException;
import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.Scanner;

public class LabProgram {

public static void main(String[] args) {
// Create LinkedList
LinkedList<String> movies = new LinkedList<>();
// Create HashSet
LinkedHashSet<String> moviesTitle = new LinkedHashSet<>();
// read file name from user
Scanner input = new Scanner(System.in);
String fileName = input.next();
try {
// create an object of Scanner
Scanner file = new Scanner(new File("movies.csv"));
// iterate each line in the file
while (file.hasNextLine()) {
String data = file.nextLine();
movies.add(data);
String[] dataArray = data.split(",");//
moviesTitle.add(dataArray[1]);
}
} catch (FileNotFoundException e) {
e.printStackTrace();
}

// format each line
for (String title : moviesTitle) {
// print title
System.out.printf("%s", title);
String time = " | ";
String ratings = " | ";
for (String movie : movies) {
String[] dataArray = movie.split(",");
if (title.equals(dataArray[1])) {
time = time + dataArray[0] + " ";
ratings = ratings + dataArray[2] + ",";
}

}
// print ratings
System.out.printf("%s", ratings.substring(0, ratings.length() - 1));
// print times
System.out.printf("%s", time.substring(0, time.length() - 1));
// print vertical bar
System.out.println();
}

}

}

 

Thr first image attatched shows what its supposed to look like and the 2nd image shows what it looks like when I try to run

**Title: Movie Show Time Display Program**

This educational page is dedicated to the "Movie Show Time Display" lab from CSC 111: Computer Programming, available through zyBooks.

### Overview:

This section is focused on helping students implement a program that displays movie showtimes based on input from a file (`movies.csv`).

### Program Workflow:

1. **Input (from above):** The program takes input data, typically consisting of movie names, ratings, and showtimes.
2. **LabProgram.java:** This is your Java program where you write the code to process the input.
3. **Output (shown below):** The results are displayed here after running your program.

### Output Example:

- **Wonders of the World** | Rating: G, G | Showtimes: 16:40, 20:00
- **End of the Universe** | Rating: NC-17 | Showtime: 19:00
- **Buffalo Bill And The Indians or Sitting Bull's History Lesson** | Rating: PG, PG, PG | Showtimes: 12:45, 15:00, 19:30
- **Adventure of Lewis and Clark** | Rating: PG-13, PG-13 | Showtimes: 10:00, 14:30
- **Halloween** | Rating: R | Showtime: 19:00

### Signature of Your Work:

Below the output, there is a “Signature of your work” section, accompanied by an interactive prompt labeled "What is this?" This might be a tool to verify the integrity or uniqueness of submissions.

For instance:
- Signature shows `10/23.. S---------|0 U-------------------------- ..10/24`

This unique signature might be used to track the progress or modification dates of the assignment.

### Reminder:

To execute your program, hit the "Run program" button, which will process the input through your Java code, generating a formatted list of movie showtimes as demonstrated.

For any questions or further assistance, consult the zyBooks catalog or help/FAQ section.

**Feedback:**
As an educational tool, user feedback is encouraged to improve the program's accessibility and functionality.

---

This explanation offers a detailed breakdown, aiming to help students grasp the purpose and execution of the Movie Show Time Display program during their coursework.
Transcribed Image Text:**Title: Movie Show Time Display Program** This educational page is dedicated to the "Movie Show Time Display" lab from CSC 111: Computer Programming, available through zyBooks. ### Overview: This section is focused on helping students implement a program that displays movie showtimes based on input from a file (`movies.csv`). ### Program Workflow: 1. **Input (from above):** The program takes input data, typically consisting of movie names, ratings, and showtimes. 2. **LabProgram.java:** This is your Java program where you write the code to process the input. 3. **Output (shown below):** The results are displayed here after running your program. ### Output Example: - **Wonders of the World** | Rating: G, G | Showtimes: 16:40, 20:00 - **End of the Universe** | Rating: NC-17 | Showtime: 19:00 - **Buffalo Bill And The Indians or Sitting Bull's History Lesson** | Rating: PG, PG, PG | Showtimes: 12:45, 15:00, 19:30 - **Adventure of Lewis and Clark** | Rating: PG-13, PG-13 | Showtimes: 10:00, 14:30 - **Halloween** | Rating: R | Showtime: 19:00 ### Signature of Your Work: Below the output, there is a “Signature of your work” section, accompanied by an interactive prompt labeled "What is this?" This might be a tool to verify the integrity or uniqueness of submissions. For instance: - Signature shows `10/23.. S---------|0 U-------------------------- ..10/24` This unique signature might be used to track the progress or modification dates of the assignment. ### Reminder: To execute your program, hit the "Run program" button, which will process the input through your Java code, generating a formatted list of movie showtimes as demonstrated. For any questions or further assistance, consult the zyBooks catalog or help/FAQ section. **Feedback:** As an educational tool, user feedback is encouraged to improve the program's accessibility and functionality. --- This explanation offers a detailed breakdown, aiming to help students grasp the purpose and execution of the Movie Show Time Display program during their coursework.
**Transcription of Schedule for Educational Content**

**Titles and Details:**

1. **Wonders of the World**
   - **Air Time:** 20:00
   - **Rating:** G
   - **Duration:** 16:40

2. **End of the Universe**
   - **Air Time:** Not specified
   - **Rating:** NC-17
   - **Duration:** 19:00

3. **Buffalo Bill And The Indians or Sitting Bull**
   - **Air Time:** 15:00, 19:30
   - **Rating:** PG
   - **Duration:** 12:45

4. **Adventure of Lewis and Clark**
   - **Air Time:** 14:30
   - **Rating:** PG-13
   - **Duration:** 10:00

5. **Halloween**
   - **Air Time:** Not specified
   - **Rating:** R
   - **Duration:** 19:00

---

**Additional Information:**

- This content appears to be part of a web-based educational platform, ZyBooks.
- The table layout includes columns for title, rating, and duration of each educational program.
- The interface has standard navigation elements such as menu and profile icons at the top right corner.
Transcribed Image Text:**Transcription of Schedule for Educational Content** **Titles and Details:** 1. **Wonders of the World** - **Air Time:** 20:00 - **Rating:** G - **Duration:** 16:40 2. **End of the Universe** - **Air Time:** Not specified - **Rating:** NC-17 - **Duration:** 19:00 3. **Buffalo Bill And The Indians or Sitting Bull** - **Air Time:** 15:00, 19:30 - **Rating:** PG - **Duration:** 12:45 4. **Adventure of Lewis and Clark** - **Air Time:** 14:30 - **Rating:** PG-13 - **Duration:** 10:00 5. **Halloween** - **Air Time:** Not specified - **Rating:** R - **Duration:** 19:00 --- **Additional Information:** - This content appears to be part of a web-based educational platform, ZyBooks. - The table layout includes columns for title, rating, and duration of each educational program. - The interface has standard navigation elements such as menu and profile icons at the top right corner.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 5 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY