Question: Simple java program done with unix (Q4) Practice: A simple Java program and pipes (10 marks) Use emacs (or vi) to create the following file

Simple java program done with unix

Simple java program done with unix (Q4) Practice: A simple Java program

(Q4) Practice: A simple Java program and pipes (10 marks) Use emacs (or vi) to create the following file Subaru,Forester, $43000 Toyota, Corolla, $29000 Mazda,5,$38000 This is a CSV file, which stands for "comma-separated values", a common textual format for storing tabular data such as spreadsheets. We refer to each piece of text before the first comma, after the last comma or between two commas as a field. Now write a simple Java program that reads text from stdin, interprets it as CSV rotates the fields of each line one position to the right, and prints the result to stdout. On the spreadsheet.csv file above, the output should look like this: $43000, Subaru, Forester $29800, Toyota, Corolla $38000,Mazda,5 r program must be able to handle Fields that include spaces and empty fields, You Files whose lines have an arbitrary number of fields (not necessarily 3), and Files whose lines have different numbers of fields. For example, on the input A,line with, 4,fields Only two,fields Lots of empty fields,,, the output should be fields,A,line with, 4 fields,Only two Lots of empty fields (a) Save your solution to a file a1q4a.java and put it under Subversion control. (b) Use the script command to create a log file a1q4b.log to create a log of the following session: Run your program on the file spreadsheet.csv above Use your program (and no other Unix commands) to create the output Forester, $43000,Subaru Corolla, $29080, Toyota 5,$3800e, Mazda without changing the Java code! Put the file a1q4b.log under Subversion control

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!