Question: Find an interesting data set in CSV format (or in spreadsheet format, then use a spreadsheet to save the data as CSV). Using the CSVReader

Find an interesting data set in CSV format (or in spreadsheet format, then use a spreadsheet to save the data as CSV). Using the CSVReader program from Exercise P7.5, read the data and compute a summary, such as the maximum, minimum, or average of one of the columns.

Data from Exercise P7.5,

The CSV (or comma-separated values) format is commonly used for tabular data. Each table row is a line, with columns separated by commas. Items may be enclosed in quotation marks, and they must be if they contain commas or quotation marks. Quotation marks inside quoted fields are doubled. Here is a line with four fields:

1729, San Francisco, "Hello, World", "He asked: ""Quo vadis?""" Write a CSVReader program that reads a CSV file, and provide methods

int numberOfRows()
int numberOfFields(int row)
String field(int row, int column)

Step by Step Solution

3.40 Rating (162 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

import csv Read in the CSV file reader csvreaderopenpopulationcsv Skip the header nextreader Initialize variables totalpop 0 maxpop 0 minpop 99999999999 Loop over the rows of the file for row in reader Add the population ... View full answer

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 Java Concepts Late Objects Questions!