This is java In this program, you are going to read in a post secondary educatio
ID: 3865154 • Letter: T
Question
This is java
In this program, you are going to read in a post secondary education data set file, Post Secondary Education.txt. You are going to create a Education object which keeps track of the SchoolID, Name of the School, the State Abbreviation their Web address.
You are going to store it into an array of Education objects. The default starting size is 10. You are going mimic an ArrayList, and when you add items you will use an add method that you create. If you run out of space, you need to expand the array (double its size) and copy all the previous items into the new array when you run out of space.
Finally, you should print out each of the objects by using a get method that you create.
Use the Post Secondary Education.txt file in Moodle.
Specifics:
1. Read in the education file and create Education objects. 2. Store each object into the array you created. 3. Initialize the array size to 10. Please do not use an actual ArrayList. 4. Create an expand method when the number of items read in exceeds the size of the array. 5. Create a size method to keep track of how large your “ArrayList.” 6. Create an add method to add items to your “ArrayList.” 7. Create a get method to get items out of your “ArrayList.” 8. Print out all the students in your “ArrayList” at the end.
Post Secondary Education.txt file
UNITID INSTNM STABBR WEBADDR
100654 Alabama A & M University AL www.aamu.edu/
100663 University of Alabama at Birmingham AL www.uab.edu
100690 Amridge University AL www.amridgeuniversity.edu
100706 University of Alabama in Huntsville AL www.uah.edu
100724 Alabama State University AL www.alasu.edu/email/index.aspx
100733 University of Alabama System Office AL www.uasystem.ua.edu
100751 The University of Alabama AL www.ua.edu/
100760 Central Alabama Community College AL www.cacc.edu
100812 Athens State University AL www.athens.edu
100830 Auburn University at Montgomery AL www.aum.edu
100858 Auburn University AL www.auburn.edu
100937 Birmingham Southern College AL www.bsc.edu/
101028 Chattahoochee Valley Community College AL www.cv.edu
101073 Concordia College Alabama AL www.ccal.edu/
101116 South University-Montgomery AL southuniversity.edu
101143 Enterprise State Community College AL www.escc.edu
101161 James H Faulkner State Community College AL www.faulknerstate.edu
101189 Faulkner University AL www.faulkner.edu
101240 Gadsden State Community College AL www.gadsdenstate.edu
101277 New Beginning College of Cosmetology AL www.nbccosmetology.com
101286 George C Wallace State Community College-Dothan AL www.wallace.edu
101295 George C Wallace State Community College-Hanceville AL www.wallacestate.edu
101301 George C Wallace State Community College-Selma AL www.wccs.edu
101365 Herzing University-Birmingham AL www.herzing.edu/birmingham
101435 Huntingdon College AL www.huntingdon.edu
101453 Heritage Christian University AL www.hcu.edu
101462 J F Drake State Community and Technical College AL www.drakestate.edu
101471 J F Ingram State Technical College AL www.istc.edu
101480 Jacksonville State University AL www.jsu.edu/
101499 Jefferson Davis Community College AL www.jdcc.edu
101505 Jefferson State Community College AL www.jeffstateonline.com
101514 John C Calhoun State Community College AL www.calhoun.edu
101541 Judson College AL www.judson.edu
101569 Lawson State Community College-Birmingham Campus AL www.lawsonstate.edu
101587 University of West Alabama AL www.uwa.edu
101602 Lurleen B Wallace Community College AL www.lbwcc.edu
Explanation / Answer
Output
100654 Alabama A & M University AL www.aamu.edu/
100663 University of Alabama at Birmingham AL www.uab.edu
100690 Amridge University AL www.amridgeuniversity.edu
100706 University of Alabama in Huntsville AL www.uah.edu
100724 Alabama State University AL www.alasu.edu/email/index.aspx
100733 University of Alabama System Office AL www.uasystem.ua.edu
100751 The University of Alabama AL www.ua.edu/
100760 Central Alabama Community College AL www.cacc.edu
100812 Athens State University AL www.athens.edu
100830 Auburn University at Montgomery AL www.aum.edu
100858 Auburn University AL www.auburn.edu
100937 Birmingham Southern College AL www.bsc.edu/
101028 Chattahoochee Valley Community College AL www.cv.edu
101073 Concordia College Alabama AL www.ccal.edu/
101116 South University-Montgomery AL southuniversity.edu
101143 Enterprise State Community College AL www.escc.edu
101161 James H Faulkner State Community College AL www.faulknerstate.edu
101189 Faulkner University AL www.faulkner.edu
101240 Gadsden State Community College AL www.gadsdenstate.edu
101277 New Beginning College of Cosmetology AL www.nbccosmetology.com
101286 George C Wallace State Community College-Dothan AL www.wallace.edu
101295 George C Wallace State Community College-Hanceville AL www.wallacestate.edu
101301 George C Wallace State Community College-Selma AL www.wccs.edu
101365 Herzing University-Birmingham AL www.herzing.edu/birmingham
101435 Huntingdon College AL www.huntingdon.edu
101453 Heritage Christian University AL www.hcu.edu
101462 J F Drake State Community and Technical College AL www.drakestate.edu
101471 J F Ingram State Technical College AL www.istc.edu
101480 Jacksonville State University AL www.jsu.edu/
101499 Jefferson Davis Community College AL www.jdcc.edu
101505 Jefferson State Community College AL www.jeffstateonline.com
101514 John C Calhoun State Community College AL www.calhoun.edu
101541 Judson College AL www.judson.edu
101569 Lawson State Community College-Birmingham Campus AL www.lawsonstate.edu
101587 University of West Alabama AL www.uwa.edu
101602 Lurleen B Wallace Community College AL www.lbwcc.edu
Program:
Main.Java
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
public class Main {
static Student arr[];
static int counter=-1;
static int size=10;
int getLen()
{
return counter;
}
static Student[] entry(Student arr[],int counter,String data[])
{
Student s=new Student();
//counter++;
s.setUNITID(Integer.parseInt(data[0]));
s.setINSTNM(data[1]);
s.setSTABBR(data[2]);
s.setWEBADDR(data[3]);
if(counter ==arr.length-1)
{
Student array[]=new Student[arr.length *2];
for(int i=0;i<arr.length;i++)
{
array[i]=arr[i];
}
array[counter]=s;
return array;
}
else
{
arr[counter]=s;
return arr;
}
}
public static void main(String[] args) {
// Reading Student Names
BufferedReader br = null;
FileReader fr = null;
try {
fr = new FileReader("Student2017.txt");
br = new BufferedReader(fr);
String sCurrentLine;
br = new BufferedReader(new FileReader("Post Secondary Education.txt"));
arr=new Student[size];
while ((sCurrentLine = br.readLine()) != null) {
String sp[]=sCurrentLine.split(" ");
arr=entry(arr,++counter,sp);
}
//Printing Values
for(int i=0;i<arr.length;i++)
{
Student s=arr[i];
if(s!=null)
System.out.println(s.getUNITID()+" "+s.getINSTNM() +" "+s.getSTABBR()+" "+s.getWEBADDR());
}
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (br != null)
br.close();
if (fr != null)
fr.close();
} catch (IOException ex) {
ex.printStackTrace();
}
}
}
}
Student.java
import java.util.ArrayList;
public class Student {
ArrayList<Integer> minutesRead=null;
int UNITID ;
String INSTNM , STABBR , WEBADDR;
public ArrayList<Integer> getMinutesRead() {
return minutesRead;
}
public void setMinutesRead(ArrayList<Integer> minutesRead) {
this.minutesRead = minutesRead;
}
public int getUNITID() {
return UNITID;
}
public void setUNITID(int uNITID) {
UNITID = uNITID;
}
public String getINSTNM() {
return INSTNM;
}
public void setINSTNM(String iNSTNM) {
INSTNM = iNSTNM;
}
public String getSTABBR() {
return STABBR;
}
public void setSTABBR(String sTABBR) {
STABBR = sTABBR;
}
public String getWEBADDR() {
return WEBADDR;
}
public void setWEBADDR(String wEBADDR) {
WEBADDR = wEBADDR;
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.