Colorado State University Logo | CS 150: Culture and Coding (AUCC 3B/GT-AH3) Colorado State University Logo | CS 150: Culture and Coding (AUCC 3B/GT-AH3)
CS 150: Culture and Coding (AUCC 3B/GT-AH3)
Computer Science

Practical Project > Biodiversity in New York State

Biodiversity by County - Distribution of Animals, Plants and Natural Communities in the State of New York(data.gov). This dataset lists Endangered or Threatened animals and plants that have been seen in New York.

Details

The columns in the data are in order:

  • County
  • Category
  • Taxonomic Group
  • Taxonomic Subgroup
  • Scientific Name
  • Common Name
  • Year Last Documented
  • NY Listing Status
  • Federal Listing Status
  • State Conservation Rank
  • Global Conservation Rank
  • Distribution Status

The two you parts you will need for the methods you are tested on are:

  • Category
    this will be either Plant or Animal

  • NY Listing Status:
    This states whether it is Endangered or Threatened

Required Methods To Implement (graded)

We will grade the following methods. Please note, that while there may be different ways to implement them, and you are free to even write helper methods (which we did ourselves) - we need the method names to match the following specification.

CSVReader

This file specifically is used to read the Comma Separated Value files using a Scanner Object. We also used it to help store the indices of the columns in constant variables for easy use in GenderStats.java.

public void initialize(String file)

This method will initialize a class level scanner object based on a File (new File(…)). The name of the file will be passed in. You can assume it is a correct name, but you should also try and catch the IOException that is required by calling new file. The following code can help you get started. You may also want to look at the Digital Humanities lab for an example.

Here is some example code that will help you.

try {
     fileScanner = new Scanner(new File(file));
 }catch (IOException io) {
     io.printStackTrace();
}

public boolean hasNext()

Returns if the scanner has more lines to read if the scanner has been initialized. If the scanner hasn’t been initialized, it will return false. Looking at how scanner checks to see if more lines need to be read will help with this method.

public String[] getNext()

If the scanner has more lines to read, it reads the line and returns a String array of all the values in the line - broken up by the comma (‘,’) delimiter! This is essentially how CSV files are stored.

Stats.java

This file is the main driver file of your program. It will calculate the percentage of endangered and threatened plants and animals.

The final output will print out “% of animals and % of plants listed are Endangered. While % of animals and % of plants listed are Threatened.” each sentence on a separate line and with the percent’s filled in.

For example:

22.76% of animals and 42.63% of plants listed are Endangered.
While 40.13% of animals and 32.13% of plants listed are Threatened.

Suggestions / Insights

Before you start coding it is always good to plan your code out. Look at what each method is asking for and think about how you can accomplish it. (Think about how a percent is calculated.)

If you would like to expand upon the data there are many different things you could look for. Examples are:

  • The total species Endangered and/or Threatened
  • Number of species spotted by county
  • You can sort them by most recent sighting to least recent or vice-versa

These are just examples feel free to come up with your own ideas of sorting/processing the data.

Reference

  • State of New York, Biodiversity by County - Distribution of Animals, Plants and Natural Communities, Updated 2018, Maintained by Open Data NY, https://data.ny.gov/api/views/tk82-7km5, Accessed Fall 2018

Computer Science Department

279 Computer Science Building
1100 Centre Avenue
Fort Collins, CO 80523
Phone: (970) 491-5792
Fax: (970) 491-2466

CS 150: Culture and Coding (AUCC 3B/GT-AH3)

Survey of computer science, formal logic, and computational thinking. Explores the historical, gender, and cultural perspectives on the role of technology in society. Includes learning a basic programming language. Students will be expected to write small programs, and construct written arguments on ways in which technology influences our modern culture. Previous computer science experience not necessary.