joshua's code

23
Joshua’s Code: Final Draft There is not all the class that I created, but it is a “final draft” of code. Most of the classes are not in the Microsoft Word document. If you want to use the first calculator, then use Calc=”STAT1”. Otherwise, use “STAT2”. SQL Connection class is not in this document, because it is created by someone else. This class is definitely need to use these calculators. Table of Contents Page 1 – Abstract Class Page 5 – 1 st Calculator Page 8 – 2 nd Calculator Page 13 – Test Code 1 st Class: Abstract Class package heuristics; import static heuristics.SingleAgeRaceGenderCalculator.getContents; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.Writer; /** * * @author amtatro */ abstract public class StatsCalculators { int sex, race, age;

Upload: joshua-randolph

Post on 06-Apr-2017

21 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Joshua's Code

Joshua’s Code: Final Draft

There is not all the class that I created, but it is a “final draft” of code. Most of the classes are not in the Microsoft Word document.

If you want to use the first calculator, then use Calc=”STAT1”. Otherwise, use “STAT2”. SQL Connection class is not in this document, because it is created by someone else. This

class is definitely need to use these calculators.

Table of ContentsPage 1 – Abstract ClassPage 5 – 1st CalculatorPage 8 – 2nd CalculatorPage 13 – Test Code

1 st Class: Abstract Class

package heuristics;

import static heuristics.SingleAgeRaceGenderCalculator.getContents;import java.io.BufferedReader;import java.io.BufferedWriter;import java.io.File;import java.io.FileNotFoundException;import java.io.FileReader;import java.io.FileWriter;import java.io.IOException;import java.io.Writer;

/** * * @author amtatro */abstract public class StatsCalculators { int sex, race, age; int nullCount=0; String database="", dateset=""; public String toString(){ return sex+","+race+","+age+","; } abstract public void receiveVal(int sex, int race, int age, Object val); abstract public String findTheNotepadDatum (String word); abstract public String finalAnswer();

Page 2: Joshua's Code

abstract public void returnFile(String newNotepad); public void receiveDate(int sex, int race, int age, Object val, Object val2){ if( this.sex==sex && this.race == race && this.age==age ){ dateset+=val.toString().substring(0,10)+","; try{ dateset+=val2.toString().substring(0,10)+","; } catch ( Exception ex ){ } } } public String compareLastDates(String date, String lastDate){ String[] ymd = date.split("-"); String[] ymd2 = lastDate.split("-"); int y= Integer.parseInt(ymd[0]), m=Integer.parseInt(ymd[1]), d=Integer.parseInt(ymd[2]); int y2= Integer.parseInt(ymd2[0]), m2=Integer.parseInt(ymd2[1]), d2=Integer.parseInt(ymd2[2]); if (y>y2 || (y==y2 && m>m2) || (y==y2 && m==m2 && d>d2)){ return date; } else{ return lastDate; } } public String compareFirstDates(String date, String firstDate){ String[] ymd = date.split("-"); String[] ymd2 = firstDate.split("-"); int y= Integer.parseInt(ymd[0]), m=Integer.parseInt(ymd[1]), d=Integer.parseInt(ymd[2]); int y2= Integer.parseInt(ymd2[0]), m2=Integer.parseInt(ymd2[1]), d2=Integer.parseInt(ymd2[2]); if (y<y2 || (y==y2 && m<m2) || (y==y2 && m==m2 && d<d2)){ return date; } else{ return firstDate; } } public String findTwoDateBaseDates(){ if (!dateset.equals("")){ String[]date=dateset.substring(0,dateset.length()-1).split(","); String[]firstDate= new String[date.length];

Page 3: Joshua's Code

String[]lastDate= new String[date.length]; for(int i=0; i<date.length; i++){ if (i>0){ firstDate[i]=compareFirstDates(date[i], firstDate[i-1]); lastDate[i]=compareLastDates(date[i], lastDate[i-1]); } else{ firstDate[i]=date[i]; lastDate[i]=date[i]; } } return firstDate[date.length-1]+"/"+lastDate[date.length-1]; } else{ return ""; } } public String findFirstAndLastDates(){ String notePadLine = findTheNotepadDatum("DATE"); if (!database.equals("") && !notePadLine.equals("")){ String[]dataBaseDate=findTwoDateBaseDates().split("/"); String[]notePadDate=notePadLine.split("/"); String finalFirstDate=compareFirstDates(dataBaseDate[0], notePadDate[0]); String finalLastDate=compareLastDates(dataBaseDate[1], notePadDate[1]); return finalFirstDate + "/"+finalLastDate; } else if(!database.equals("")){ return findTwoDateBaseDates(); } else{ return notePadLine; } } static public String getContents(File aFile) { //...checks on aFile are elided StringBuffer contents = new StringBuffer();

//declared here only to make visible to finally clause BufferedReader input = null; try { //use buffering //this implementation reads one line at a time input = new BufferedReader( new FileReader(aFile) );

Page 4: Joshua's Code

String line = null; //not declared within while loop while (( line = input.readLine()) != null){ contents.append(line); contents.append(System.getProperty("line.separator")); } } catch (FileNotFoundException ex) { //ex.printStackTrace(); } catch (IOException ex){ //ex.printStackTrace(); } finally { try { if (input!= null) { //flush and close both "input" and its underlying FileReader input.close(); } } catch (IOException ex) { //ex.printStackTrace(); } } return contents.toString(); } static public void setContents(File aFile, String aContents) throws FileNotFoundException, IOException { if (aFile == null) { throw new IllegalArgumentException("File should not be null."); }

//declared here only to make visible to finally clause; generic reference Writer output = null; try { //use buffering output = new BufferedWriter( new FileWriter(aFile) ); output.write( aContents ); } finally { //flush and close both "output" and its underlying FileWriter if (output != null) output.close(); } }}

Page 5: Joshua's Code

1 st Class: 1 st Calculator Class package heuristics;

import static heuristics.Tester.setContents;import java.io.File;

/** * * @author amtatro */public class StatsCalculator1 extends StatsCalculators { File data = new File( "c:/Users/amtatro/Desktop/1stCalc.txt"); String oldNotePad=getContents(data); double total = 0, sumOfDifferenceSquared=0; int count = 0, totalCount=0; StatsCalculator1(int sex, int race, int age){ this.sex=sex; this.race=race; this.age=age; } public String findTheNotepadDatum(String word){ if (!oldNotePad.equals("")){ for( String rowAsAString : oldNotePad.split("\r\n")){ String[] row = rowAsAString.split(","); int row1 = Integer.parseInt(row[0]); int row2 = Integer.parseInt(row[1]); int row3 = Integer.parseInt(row[2]); if (sex==row1 && race==row2 && age==row3){ switch(word){ case "DATE": return row[4]; case "STAT": return row[3]; } } } return ""; } else{ return ""; } } public void receiveVal(int sex, int race, int age, Object val){ if( this.sex == sex && this.race == race && this.age == age ){ try{

Page 6: Joshua's Code

total += Double.parseDouble(val.toString()); //"abcd" count ++; if (count!=1){ database+=","+val.toString(); } else{ database+=val.toString(); } } catch ( Exception ex ){ nullCount++; } } } public String toString2(){ return "Sex=" + sex+ ", Race="+race+ ", Age="+age; } public double findAverage(double sum, double count){ return sum/count; } public double findSumOfSquareOfDifference(){ double average=findAverage(total, count); if (count>=1 ){ String [] val = database.split(","); for (int i=0; i<val.length; i++){ Double difference=(Double.parseDouble(val[i])-average); sumOfDifferenceSquared+=difference*difference; } return sumOfDifferenceSquared; }else{ return 0.0; } }

public String findMaxAndMin(){ if (!database.equals("")){ String [] val = database.split(","); double [] max = new double [val.length]; double [] min = new double [val.length]; for (int i=0; i<val.length; i++){ if (i!=0){ max[i]=Math.max(Double.parseDouble(val[i]), max[i-1]); min[i]=Math.min(Double.parseDouble(val[i]), min[i-1]); } else{

Page 7: Joshua's Code

max[i]=Double.parseDouble(val[i]); min[i]=Double.parseDouble(val[i]); } } return max[val.length-1]+"/"+min[val.length-1]; } else{ return ""; } } public String finalAnswer(){ String NotePadLine=findTheNotepadDatum("STAT"); if (!NotePadLine.equals("")){ String[]StatVal=NotePadLine.split("/"); double total2 = Double.parseDouble(StatVal[0]), sumOfDifferenceSquared2=Double.parseDouble(StatVal[4]), max2=Double.parseDouble(StatVal[2]), min2=Double.parseDouble(StatVal[3]); int count2 = Integer.parseInt(StatVal[1]), nullCount2=Integer.parseInt(StatVal[5]); if(count==0){ String dateExtremes=findFirstAndLastDates(); System.out.println(toString2()+", first/last date="+dateExtremes+", count(value)="+count2+", count(no value)="+nullCount2+", average="+findAverage(total2, count2)+", max="+max2+", min="+min2+", sample stdev=" +Math.sqrt(sumOfDifferenceSquared2/(count2-1))); return toString()+NotePadLine+","+dateExtremes+"\r\n"; } else { String [] dBExtreme=findMaxAndMin().split("/"); sumOfDifferenceSquared+=findSumOfSquareOfDifference(); double overallTotal = total+total2, finalMax=Math.max(Double.parseDouble(dBExtreme[0]),max2), finalMin=Math.min(Double.parseDouble(dBExtreme[1]), min2); int overallCount = count+count2; int overallNullCount=nullCount+nullCount2; double difference=total*total/count+total2*total2/count2-overallTotal*overallTotal/overallCount; double totalSumSqDiff=sumOfDifferenceSquared+sumOfDifferenceSquared2+difference; String dateExtremes=findFirstAndLastDates(); System.out.println(toString2()+", first/last date="+dateExtremes+", count(value)="+overallCount+", count(no value)="+overallNullCount+", average="+findAverage(overallTotal, overallCount)+", max="+finalMax+", min="+finalMin+", sample stdev="+Math.sqrt(totalSumSqDiff/(overallCount-1))); return toString()+overallTotal+"/"+overallCount+"/"+finalMax+"/"+finalMin+"/"+totalSumSqDiff+"/"+overallNullCount+","+dateExtremes+"\r\n";

Page 8: Joshua's Code

} } else{ if (count!=0){ sumOfDifferenceSquared+=findSumOfSquareOfDifference(); String [] dBExtreme=findMaxAndMin().split("/"); String dateExtremes=findFirstAndLastDates(); System.out.println(toString2()+", first/last date="+dateExtremes+", count(value)="+count+", count(no value)="+nullCount+", average="+findAverage(total, count)+", max="+dBExtreme[0]+", min="+dBExtreme[1]+", sample stdev=" +Math.sqrt(sumOfDifferenceSquared/(count-1))); return toString()+total+"/"+count+"/"+dBExtreme[0]+"/"+dBExtreme[1]+"/"+sumOfDifferenceSquared+"/"+nullCount+","+findFirstAndLastDates()+"\r\n"; } else{ return ""; } } } public void returnFile(String newNotepad){ try { if(!newNotepad.equals("")){ setContents(data, newNotepad.substring(0,newNotepad.length()-2)); } else{ setContents(data, newNotepad); } } catch(Exception ex){ } } }

2 nd Class: 2 st Calculator Class package heuristics;

import static heuristics.StatsCalculators.getContents;import static heuristics.Testing2ndCal.setContents;import java.io.File;import java.util.HashMap;

/** * * @author amtatro */

Page 9: Joshua's Code

public class StatsCalculator2 extends StatsCalculators{ File data = new File( "c:/Users/amtatro/Desktop/2ndCalc.txt"); String oldNotePad=getContents(data); double total=0, lost=0; String modeDatum=""; StatsCalculator2(int sex, int race, int age){ this.sex=sex; this.race=race; this.age=age; } public void receiveVal(int sex, int race, int age, Object val){ if( this.sex==sex && this.race == race && this.age==age ){ try{ database+=val.toString()+","; } catch ( Exception ex ){ nullCount++; } } } public String findTheNotepadDatum(String word){ if (!oldNotePad.equals("")){ for( String rowAsAString : oldNotePad.split("\r\n")){ String[] row = rowAsAString.split(","); int row1 = Integer.parseInt(row[0]); int row2 = Integer.parseInt(row[1]); int row3 = Integer.parseInt(row[2]); if (sex==row1 && race==row2 && age==row3){ switch(word){ case "DATE": return row[3]; case "MODE": return row[4]; case "LOST": return row[5]; } } } return ""; } else{ return ""; } } public String computeDataBaseMode(){ HashMap<String, Integer> count = new HashMap();

Page 10: Joshua's Code

for( String color : database.substring(0,database.length()-1).split(",") ){ if( !count.containsKey(color) ){ count.put(color, 0); } int countsofar = count.get(color); countsofar ++; count.put(color, countsofar); } String changedDataBase=""; for( String key : count.keySet() ){ changedDataBase+=key+"\t"+count.get(key)+"\t"; } return changedDataBase.substring(0,changedDataBase.length()-1); } public String computeMode(){ if (database.equals("")){ if (!findTheNotepadDatum("MODE").equals("")){ modeDatum = findTheNotepadDatum("MODE"); } else{ modeDatum = ""; } return modeDatum+"\n"+0; } else{ String[] dataBaseColor = computeDataBaseMode().split("\t"); if (findTheNotepadDatum("MODE").equals("")){ for(int i=0; i<dataBaseColor.length; i=i+2){ total+=Double.parseDouble(dataBaseColor[i+1]); } for( int i=0; i<dataBaseColor.length; i=i+2 ){ if(Double.parseDouble(dataBaseColor[i+1])/total>=0.1){ modeDatum+=dataBaseColor[i]+"\t"+dataBaseColor[i+1]+"\t"; } } String[]modeDatumColor=modeDatum.substring(0,modeDatum.length()-1).split("\t"); lost+=total; for (int i=0; i<modeDatumColor.length; i=i+2){ lost=lost-Integer.parseInt(modeDatumColor[i+1]); } if (lost!=0.0){ System.out.println(toString()+(int)lost+" is/are losted because characteristic(s) make up less than 10%");

Page 11: Joshua's Code

} } else{ String[] notePadColor = findTheNotepadDatum("MODE").split("\t"); String [] newNotePadColor = new String[notePadColor.length+dataBaseColor.length]; int [] sum = new int [notePadColor.length+dataBaseColor.length]; int countSameColor=0; for( int i=0; i<dataBaseColor.length; i=i+2 ){ for (int j=0; j<notePadColor.length; j=j+2){ if (dataBaseColor[i].equals(notePadColor[j])){ sum[countSameColor] = Integer.parseInt(dataBaseColor[i+1])+Integer.parseInt(notePadColor[j+1]); newNotePadColor[countSameColor] = dataBaseColor[i]; countSameColor++; break; } } } if (countSameColor!=0){ int countDiffColor = 0; for(int i=0; i<dataBaseColor.length; i=i+2 ){ for (int j=0; j<countSameColor; j++){ if (dataBaseColor[i].equals(newNotePadColor[j])){ break; } else if (!dataBaseColor[i].equals(newNotePadColor[j]) && j==countSameColor-1){ sum[countSameColor+countDiffColor] = Integer.parseInt(dataBaseColor[i+1]); newNotePadColor[countSameColor+countDiffColor] = dataBaseColor[i]; countDiffColor++; } } } for (int i=0; i<notePadColor.length; i=i+2){ for (int j=0; j<countSameColor; j++){ if (notePadColor[i].equals(newNotePadColor[i])){ break; } else if (!notePadColor[i].equals(newNotePadColor[j]) && j==countSameColor-1){ sum[countSameColor+countDiffColor] = Integer.parseInt(notePadColor[i+1]); newNotePadColor[countSameColor+countDiffColor] = notePadColor[i]; countDiffColor++;

Page 12: Joshua's Code

} } } for (int i = 0; i<countSameColor+countDiffColor; i++){ total += sum[i]; } for (int i = 0; i<countSameColor+countDiffColor; i++){ if(sum[i]/total >0.1){ modeDatum+=newNotePadColor[i]+"\t"+sum[i]+"\t"; } } } else{ for (int i=0; i<notePadColor.length; i=i+2){ total +=Double.parseDouble(notePadColor[i+1]); } for (int i=0; i<dataBaseColor.length; i=i+2){ total +=Double.parseDouble(dataBaseColor[i+1]); } for (int i=0; i<notePadColor.length; i=i+2){ if(Double.parseDouble(notePadColor[i+1])/total>=0.1){ modeDatum+=notePadColor[i]+"\t"+notePadColor[i+1]+"\t"; } } for(int i=0; i<dataBaseColor.length; i=i+2){ if(Double.parseDouble(dataBaseColor[i+1])/total>=0.1){ modeDatum+=dataBaseColor[i]+"\t"+dataBaseColor[i+1]+"\t"; } } } String[]modeDatumColor=modeDatum.substring(0,modeDatum.length()-1).split("\t"); lost+=total; for (int i=0; i<modeDatumColor.length; i=i+2){ lost=lost-Integer.parseInt(modeDatumColor[i+1]); } if (lost!=0.0){ System.out.println(toString()+(int)lost+" more is/are losted because characteristic(s) make up less than 10%"); } } return modeDatum.substring(0,modeDatum.length()-1)+"\n"+(int)lost; } } public String finalAnswer(){

Page 13: Joshua's Code

if (nullCount!=0){ System.out.println(toString()+nullCount+ " more have no value."); } if (!dateset.equals("") || !findTheNotepadDatum("DATE").equals("")){ String [] Number =computeMode().split("\n"); lost=Integer.parseInt(Number[1])+nullCount; String moreLost=findTheNotepadDatum("LOST"); if (!findTheNotepadDatum("LOST").equals("")){ lost+=Integer.parseInt(moreLost); } String finalAnswer=sex+","+race+","+age+","+findFirstAndLastDates()+","+Number[0]+","+(int)lost; System.out.println(finalAnswer.replaceAll("\t", "|")); return finalAnswer+"\r\n"; } else{ return ""; } } public void returnFile(String newNotepad){ try{ setContents(data, newNotepad.substring(0,newNotepad.length()-2)); } catch(Exception ex){ } }}

Test Codepackage heuristics;

import static heuristics.Testing2ndCal.setContents;import java.io.BufferedWriter;import java.io.File;import java.io.FileNotFoundException;import java.io.FileWriter;import java.io.IOException;import java.io.Writer;import java.sql.Connection;import java.util.HashMap;

/** * * @author amtatro */public class StatsCalculatorTestCode {

Page 14: Joshua's Code

public static void main( String args[] )throws Exception { String Calc="STAT2"; //"STAT1" use the StatsCalculator1 class //"STAT2" use the StatsCalculator2 class if( args.length <2 ){ //i didn't get any arguments, here's the default args = "FLO:7,@".split(","); System.err.println("I didn't get any arguments, using "+args[0]+" and modifier of @" ); } //This test code is for the SingleAgeRaceGenderCalculator. /*Program SingleAgeRaceGenderCalculator seemed to working well when - CONCEPT_CD=FLO:8 - CONCEPT_CD=FLO:9 - CONCEPT_CD=FLO:10 Note: data, such as from FLO:6, deals with real numbers. Therefore, most of the statistical number in SingleAgeRaceGenderCalculator is computed as Double. The one exception is the count, which is an integer. */ //Other program SingleAgeRaceGenderCalculator2 seemed to be working well when CONCEPT_CD=FLO:7; String drvd = "oracle.jdbc.OracleDriver"; String urld = "jdbc:oracle:thin:@i2b2dev.urmc-sh.rochester.edu:1521:i2b2"; String usrd = "i2b2demodata"; String pwdd = "demouser"; Class.forName( drvd ); //loads driver by name Connection myDataDb = java.sql.DriverManager.getConnection( urld, usrd, pwdd ); System.out.println("Querying Data"); SQLUtilities selector = new SQLUtilities(myDataDb, "SELECT OBSERVATION_FACT.PATIENT_NUM, " + "PATIENT_DIMENSION.RACE_CD, " + "PATIENT_DIMENSION.AGE_IN_YEARS_NUM, " + "PATIENT_DIMENSION.SEX_CD," + "OBSERVATION_FACT.TVAL_CHAR," + "OBSERVATION_FACT.START_DATE," + "OBSERVATION_FACT.END_DATE," + "OBSERVATION_FACT.NVAL_NUM " + "FROM OBSERVATION_FACT, PATIENT_DIMENSION "

Page 15: Joshua's Code

+ "WHERE OBSERVATION_FACT.PATIENT_NUM= PATIENT_DIMENSION.PATIENT_NUM AND " + "CONCEPT_CD='" + args[0] + "' AND MODIFIER_CD ='" + args[1] + "' AND " + "START_DATE BETWEEN TO_DATE('20110511','YYYYMMDD') AND TO_DATE('20120511','YYYYMMDD')" ); HashMap<Object,Integer>sexCd=new HashMap(); sexCd.put("M", 0); sexCd.put("F", 1); HashMap<Object,Integer>raceCd=new HashMap(); raceCd.put("WHITE", 0); raceCd.put("BLACK", 1); raceCd.put("ASIAN", 2); raceCd.put("HISPANIC", 3); raceCd.put("OTHER", 4); raceCd.put("NATIVE HAWAIIAN/PAC ISLANDER", 5); raceCd.put("REFUSED", 6); HashMap<Object,Integer>ageGp=new HashMap(); ageGp.put(0, 0); ageGp.put(1, 1); ageGp.put(2, 2); ageGp.put(3, 3); ageGp.put(4, 4); ageGp.put(5, 5); ageGp.put(6, 6); ageGp.put(7, 7); ageGp.put(8, 8); int[] age = {0,11,18,35,45,55,65,75,85}; int[] dBSNum = new int[selector.getSize()], dBRNum = new int[selector.getSize()], dBANum = new int[selector.getSize()]; int[] patientNum=new int[selector.getSize()]; StatsCalculators[] calculators = new StatsCalculators[sexCd.size()*raceCd.size()*ageGp.size()]; int count=0; for( int i = 0 ; i < sexCd.size(); i++ ){ for( int j = 0 ; j < raceCd.size(); j++ ){ for( int k = 0 ; k < ageGp.size(); k++ ){ switch(Calc){

Page 16: Joshua's Code

case "STAT1": calculators[count]=new StatsCalculator1(i , j , k); break; case "STAT2": calculators[count]=new StatsCalculator2(i , j , k); } count++; } } } System.out.println("Showing data"); System.out.println("Sex- Male: 0, Female: 1"); System.out.println("Race- White: 0, Black: 1, Asian: 2, Hispanic: 3, Other races: 4, Native Hawaiian/Pac Islander:5, Refused:6"); System.out.println("Age Group- 0-10: 0, 11-17: 1, 18-34: 2, 35-44: 3, 45-54: 4, 55-64: 5, 65-74:6, 75-84:7, >84: 8"); for( int i = 0; i < selector.getSize(); i++ ){ HashMap line = selector.getNextHashLine(); int patientAge = Integer.parseInt(line.get("AGE_IN_YEARS_NUM").toString()); patientNum[i] = Integer.parseInt(line.get("PATIENT_NUM").toString()); if (i!=0 && patientNum[i]==patientNum[i-1]){ dBSNum[i]=dBSNum[i-1]; dBRNum[i]=dBRNum[i-1]; dBANum[i]=dBANum[i-1]; } else{ dBSNum[i]=sexCd.get(line.get("SEX_CD")); try{ dBRNum[i]=raceCd.get(line.get("RACE_CD")); } catch(Exception ex){ System.out.println(line.get("RACE_CD")); } for (int j=0; j<age.length-1; j++){ if (patientAge>=age[j] && patientAge<age[j+1]){ dBANum[i]=ageGp.get(j); break; } } if (patientAge>age[age.length-1]){ dBANum[i]=ageGp.get(age.length-1); } } for( StatsCalculators calculator : calculators ){ //If Calc is "STAT1", then test code use the NVAL_NUM to find the average, max, min, and standard deviation

Page 17: Joshua's Code

switch (Calc){ case "STAT1": calculator.receiveVal(dBSNum[i],dBRNum[i], dBANum[i], line.get("NVAL_NUM")); break; case "STAT2": calculator.receiveVal(dBSNum[i],dBRNum[i], dBANum[i], line.get("TVAL_CHAR")); } //The calculator both use the start and end date to find the first and last date //Some of the data do not seemed to use an end date. //Note: the start and end date may be from the line include info that is losted. calculator.receiveDate(dBSNum[i],dBRNum[i], dBANum[i], line.get("START_DATE"), line.get("END_DATE")); } } selector.close(); switch(Calc){ case "STAT1":System.out.print(""); break; case "STAT2":System.out.println("Sex, Race, Age, First Date/Last Date, Character|Mode...,lost Count"); } String newNotePad=""; for( StatsCalculators calculator : calculators ){ newNotePad+=calculator.finalAnswer(); } calculators[0].returnFile(newNotePad); }}