Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

General Instructions: How to Submit Your Work You must submit your assignment answers electronically: Change into your subversion directory on bluenose: cd /csci2132/svn/CSID Create a

image text in transcribedimage text in transcribed

General Instructions: How to Submit Your Work You must submit your assignment answers electronically: Change into your subversion directory on bluenose: cd /csci2132/svn/CSID Create a directory to hold your assignment answers: mkdir al Change into your assignment directory: cd a1 Create files inside the al directory as instructed in the questions below and put them under Subversion control using svn add . Only add the files you are asked to add! Once you are done answering all questions in the assignment (or the ones that you are able to answer-hopefully all), the contents of your a1 directory should look something like this: alql.txt a1q2.log a1q3.log Submit your work using svn commit -m"Submit Assignment 1" (Q4) Practice: A simple Java program and pipes (10 marks) Use emacs (or vi) to create the following file: spreadsheet.csv 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 $29000, Toyota, Corolla $38000, Mazda,5 Your program must be able to handle Fields that include spaces and empty fields, . 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 alq4a.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, $29000, Toyota 5, $38000,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

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

Database Processing

Authors: David J. Auer David M. Kroenke

13th Edition

ISBN: B01366W6DS, 978-0133058352

More Books

Students also viewed these Databases questions

Question

Compute the optimal order quantity of DVD players.

Answered: 1 week ago

Question

What is management growth? What are its factors

Answered: 1 week ago