// DrJava saved history v2 // you must first Declare an array int dailySales []; // you must then create it (using new) dailySales = new int [7]; // alternatively you can both declare an array and insert elements int dailyPurchases [] = {59, 64, 25, 36, 85, 8, 93}; //to access items in your array dailyPurchase[4] dailyPurchases[4] // assign a value to sales for day 3 dailySales[2] = 53; dailySales[2] // determine the number of elements in your array using the length variable dailySales.length //we looked at using for loops to access values in our array for (int i = 0; i < dailyPurchases.length; i++) { System.out.println("purchases for day " + (i + 1) + ": " + dailyPurchases[i]); } // Using the methods we have created. Headquarters.DAYS_OF_WEEK[3] // first create the stores Store stores [] = {new Store("Faisal's number store", "Faisal"), new Store("Abe's stat store", "Abe"), new Store("Alvinas medical office", "Alvina")}; // now create a head office Headquarters hq = new Headquarters(stores); // now lets add some values - we can use a loop to populate our tables // first Faisal's number store for (int i = 1; i < 8; i ++) { hq.setSales("Faisal's number store", i, (i * 3)+7); }; for (int i = 1; i < 8; i ++) { hq.setPurchases("Faisal's number store", i, (i * 2)+4); }; // now be's stat store for (int i = 1; i < 8; i ++) { hq.setSales("Abe's stat store", i, (i * 2) + 57); }; for (int i = 1; i < 8; i ++) { hq.setPurchases("Abe's stat store", i, (i) + 23); }; // finally Alvinas medical office for (int i = 1; i < 8; i ++) { hq.setSales("Alvinas medical office", i, (i * 200) + 5); }; for (int i = 1; i < 8; i ++) { hq.setPurchases("Alvinas medical office", i, (i * 43) + 74); }; // now lets print our sales summary hq.printStoreActivity(2);