Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Analyzing Owl Dataset 1 Owl Class One of the tracks offered by the Computer Science degree is Big Data. An important part of Big Data
Analyzing Owl Dataset 1 Owl Class One of the tracks offered by the Computer Science degree is Big Data. An important part of Big Data is being able to process a large dataset and perform some sort of analysis on it. For this lab, we're going to be doing some statistical analysis on populations of owls. Before we do so, we need to model our owls: let's make an Owl class. Each Owl has its own name, age, and weight, so we need class variables (types String, int, and double respectively) to reflect this. The first method we need to make is a constructor for the Owl class: public Owl(String name, int age, double weight) this initializes the class variables of each Owl object to the arguments passed in. It is good practice to make all your class variables private. Once we do this, we also need to make getter and setter methods to access these private variables from outside the Owl class. Finally include the method: public boolean equals (Owl other) This returns true if the name, age, and weight of the Owl are equal to other's name, age, and weight. Otherwise, this returns false. Remember to use the equals method to compare Object types like String, and use == to compare scalar types such as double and int Milestone 1: In a main method, instantiate two owls, and demonstrate your equals method working. 2 OwlPopulation Class Next, we'll need to create an Object type to model a population of owls. For this milestone, modify the given OwlPopulation class. This class will have the following variables: private String fileName and private Owl [] data. The OwlPopulation constructor should take in a filename and call the following method. public boolean populateData() this will readin the CSV file and construct the Owl objects to put into the OwlPopulation's data attribute. In order to read in the CSV file, we will again utilize the Scanner class. The populateData method is partially filled out for you. It already reads in a file line by line. You may modify this code to use in your OwlPopulation class. Hint: A CSV file (comma-separated-value file), as its name suggests, separates each value with a comma. In this file, each line contains the name, age, weight] attributes for an individual owl. The following methods may be useful to you in parsing the file: split(String delimiter) is called on a String. It splits the string into an array of substrings delimited by the argument passed in. Integer.parseInt(String num) and Double.parseDouble(String num) both take in a String object and return an int or javadouble version of the String input. Milestone 2: Show OwlPopulation being constructed correctly. Print the number of owls in the population to the console
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started