/* Marcella Wong Project 1 */ //package project1; import java.io.*; import java.util.*; import java.text.DecimalFormat; public class Orders { public String fieldArray[] = new String[13]; public String rows; public int index =0; public BufferedReader br; public String dayArray[] = new String[3]; public String freightArray[] = new String[1]; public String monthArray[] = new String[12]; public double totalFreightMonth[] = {0,0,0,0,0,0,0,0,0,0,0,0}; String totalFreight[] = new String[12]; DecimalFormat df = new DecimalFormat("0.00"); public Orders() throws IOException { String file = "Orders.csv"; br = new BufferedReader(new FileReader(file)); rows = br.readLine(); rows = br.readLine(); } //end Orders constructor public void sortFields() throws IOException { while (rows != null) { fieldArray=rows.split(","); dayArray=fieldArray[3].split("-"); if (dayArray[2].compareTo("97") == 0) { for (int i=0; i totalFreightMonth[i]) { minFreightAmt=totalFreightMonth[i]; minMonthIndex= i; } // end IF } // end FOR loop return minMonthIndex; } // end MonMin() public String GrandTotal() { String grandTotal; double total=0; for (int i=0; i<=11; i++) { total = total + totalFreightMonth[i]; } grandTotal=df.format(total); return grandTotal; } // end GrandTotal() } //end class Orders