Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I'm having trouble with the whitespace requirement. Can someone help? LabProgram java Loddefault template gwu 1 import java.io.File; 2 import java.io.FileNotFoundException; 3 import java.util.LinkedHashSet; 4

I'm having trouble with the whitespace requirement. Can someone help?
image text in transcribed
image text in transcribed
LabProgram java Loddefault template gwu 1 import java.io.File; 2 import java.io.FileNotFoundException; 3 import java.util.LinkedHashSet; 4 import java.util.Linkedlist: 5 import java.util.Scanner; 6 7 public class LabProgram { 9 public static void main(Stringi args) ! 10 LinkedList movies new Linkedlist.o: 11 LinkedHashSet String> moviesTitle - new LinkedHashSeto: 12 Scanner input-new Scanner(System.in); 13 String fileName - input.next: 14 try { 15 16 Scanner file - new Scanner(new File(FileName)); 17 while (file hasNextLine) 18 String data file.nextLine(); 19 movies.add(data); 20 String dataArray - data.split(); 21 moviesTitle.add(dataArray[1]): 22 23 } catch (FileNotFoundException e) 24 e.printStackTrace(): 25 > 26 27 // format each line 28 for (String title 1 moviesTitle) 29 W print title 30 System.out.printf("X-445 1" title.substringco, Math.min(title, length. 445); 31 String time - 32 String ratings - 33 for (String movie sovies) 34 String dotoArray movie.split(.. if (title.equals(datorray tine-time dotaArray] ratings - dotoArray(2) 39 40 W print ratings 42 System.out.printf("x56 1. ratings.substringce, ratings. length); 43 Bystem.out.printre X-25%, tid.substringcotime.lengtho 1)) 45 46 47 System.out.println 48 49 35 36 37 44 Developmode Similmede When one developing your program press the Submit for grading button below This will submit your program for auto grading 0/3 are output A Special character legend but is nearly correct, but whitespace differs. See highlights below. Input movies.csv Sf the World 1 G 16:40 20:00 Co Space | PG-13 19:00 Your output 3111 And The Indians or Sitting Bull 1 PG 12:45 15:00 19:30 of Lewis and Clark PG-13 | 10:00 14:30 1 R! 19:00 Wonders of the World 1 G 16:40 20:00 Journey to Space | PG-13 19:00 Expected output Buffalo Bill And The Indians or Sitting Bull 1 PG 12:45 15:00 19:30 Adventure of Lowla and Clark 1 PG-13 | 10:00 14:30 talloween R1 19:00 0/3 Compare output Output is nearly correct, but whitespace differs. See highlights below. Special character legend Input movies.com Your output Wonders of the World GT 16:40 20:00 22:15 Journey to Space IPG-13 19:00 Investigating the Shockingly Big World of Am G1 19:30 22:15 Buffalo And The Indians or sitting Bull 1 PG 10:30 12:4515:00 adventure of Lewis and lack 1 PG-13 10:00 14:30 alloween RI 19:00 21:00 Expected output Wonders of the World Journey to Space Investigating the shockingly Big World of Am Baftato And The Indians OL sitting Bull Adventure of Lewis and Clark Halloween G 16:40 20:00 22:15 PG-13 19:00 G 19:30 22:15 PGRI 10:30 12:45 15:00 1 PG-13 1 10100 14:30 RI 19100 21:00

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

Step: 3

blur-text-image

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

Securing SQL Server Protecting Your Database From Attackers

Authors: Denny Cherry

1st Edition

1597496251, 978-1597496254

More Books

Students also viewed these Databases questions

Question

Define and discuss the process of planned change.

Answered: 1 week ago