subject
Computers and Technology, 20.10.2020 20:01 Eylul30

Import java. io. File; import java. io. FileNotFoundException;
import java. util. Scanner;
public class OwlPopulation extends Owl{
private String fileName;
private Owl[] data;
public void populateData() throws FileNotFoundException{
File f = new File(fileName);
Scanner scanner = new Scanner(f);
int numLines = 0;
while(scanner. hasNextLine()){
numLines++;
String s = scanner. nextLine();
}
scanner. close();
data = new Owl[numLines]; //data is is allocated the exact amount of space it needs
scanner = new Scanner(f);
//TODO: Populate the data with owls constructed from the lines of the file given
}
public OwlPopulation(String fileName) throws FileNotFoundException{
//TODO: Populate the class variables in OwlPopulation
}
public double averageAge(){
//TODO: implement
return -1;
}
public Owl getYoungest(){
//TODO: implement
return null;
}
public Owl getHeaviest(){
//TODO: implement
return null;
}
public String toString(){
//TODO: implement
return null;
}
public boolean containsOwl(Owl other){
//TODO: method you can implement as a helper function to your merge method
return false;
}
public void merge(OwlPopulation other){
//TODO: a brief overview of what you can do to implement this method is given below:
//1) determine (and store) the distinct owls in the other population.
//2) make a new data array to hold the correct number of owls for the merged population
//3) copy over the distinct owls from each population to the data array
//4) set the new data array to "this" data (where is the merged population? what happens to the original populations?)
}
public int popSize(){
return data. length;
}
public static void main(String[] args) {
try {
//The following should run when you are complete. Feel free to comment out as you see fit while you work.
OwlPopulation pop1 = new OwlPopulation("owlPopulation1.csv") ;
System. out. println(pop1);
System. out. println(pop1.popSize());
OwlPopulation pop2 = new OwlPopulation("owlPopulation2.csv") ;
System. out. println(pop2);
System. out. println(pop2.popSize());
pop1.merge(pop2);
System. out. println(pop1);
System. out. println(pop1.popSize());
}
catch (FileNotFoundException f){
System. out. println("File not found.");
}
}
}

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 23:30
Which text format is this, "the text is transcribed exactly as it sounds and includes all the utterances of the speakers. "?
Answers: 2
question
Computers and Technology, 23.06.2019 01:40
You have a linux system that has a 1000gb hard disk drive, which has a 90gb partition containing an ext4 filesystem mounted to the / directory and a 4gb swap partition. currently, this linux system is only used by a few users for storing small files; however, the department manager wants to upgrade this system and use it to run a database application that will be used by 100 users. the database application and the associated data will take up over 200gb of hard disk space. in addition, these 100 users will store their personal files on the hard disk of the system. each user must have a maximum of 5gb of storage space. the department manager has made it very clear that this system must not exhibit any downtime as a result of hard disk errors. how much hard disk space will you require, and what partitions would you need to ensure that the system will perform as needed? where would these partitions be mounted? what quotas would you implement? what commands would you need to run and what entries to /etc/fstab would you need to create? justify your answers.
Answers: 3
question
Computers and Technology, 23.06.2019 04:00
Laire writes a letter to her grandmother, in which she describes an amusement park she visited last week. she adds pictures of that place in her letter. which feature of a word processing program will claire to remove unwanted parts of the pictures?
Answers: 3
question
Computers and Technology, 23.06.2019 16:30
If i wanted to include a built-in calendar in a document, what option could i select? draw table insert table insert chart quick tables
Answers: 1
You know the right answer?
Import java. io. File; import java. io. FileNotFoundException;
import java. util. Scanner;
Questions
question
Spanish, 09.03.2021 05:00
question
Mathematics, 09.03.2021 05:00
question
Biology, 09.03.2021 05:00
question
Mathematics, 09.03.2021 05:00
question
Mathematics, 09.03.2021 05:00
Questions on the website: 13722361