public class Data
extends Object
| Modifier and Type | Field and Description |
|---|---|
private static int |
COLLEGE
Sets the index of the COLLEGE CODE when reading from the file format (for ease of reading in the code).
|
private CollegeDemographics[] |
collegeDemographics
Created a default array of only two colleges for this assignment.
|
private static int |
GENDER
Index of the GENDER, set to 5
|
private static int |
PRIMARY_MAJOR_DESC
Index of PRIMARY_MAJOR_DESC, set to 3
|
private String |
term
Value of the term to load - set in the constructor
|
private static int |
TERM
Index of the TERM, set to 4
|
| Constructor and Description |
|---|
Data(String term)
Builds the Data object and ets the
term for the Data. |
| Modifier and Type | Method and Description |
|---|---|
void |
loadData(String filename)
Loads the data into the array objects.
|
void |
printStats()
For each college in
collegeDemographics, loops through
and prints the CollegeDemographics.getTable() to the console. |
private static final int COLLEGE
private final CollegeDemographics[] collegeDemographics
private final CollegeDemographics[] collegeDemographics = {
new CollegeDemographics("NS", "Natural Sciences"),
new CollegeDemographics("EG", "Engineering")
};
private static final int GENDER
private static final int PRIMARY_MAJOR_DESC
private final String term
private static final int TERM
public void loadData(String filename)
A couple things to consider with implementation
CSVReader.hasNext(), loop though all the information CSVReader.getNext() has less than six values, skip.TERM location in the array returned. Is the value
not equal to term, then skip it. CollegeDemographics.addGenderDemographic(String, String)
filename - the name of the file that contains gender demographicsCollegeDemographics.addGenderDemographic(String, String),
CSVReader.getNext(),
CSVReader.hasNext()public void printStats()
collegeDemographics, loops through
and prints the CollegeDemographics.getTable() to the console.