public static void main(String[] args) { // Here modifier is not permitted and only final is allowed Student[] lab2 = new Student[40]; // Create an array of 40 students int count = 0; // To store the number of students try { // Read file from current project directory // Students' number more than 40. If you want to test this case, uncomment next. lab2 = Util.readFile("src/More_than_40.txt", lab2); // Students' number less than 40. If you want to test this case, uncomment next. // lab2 = Util.readFile("src/Less_than_40.txt",lab2); // Students' number equals to 40. If you want to test this case, uncomment next. // lab2 = Util.readFile("src/Equals_to_40.txt",lab2); } catch (FixedException e) { // To handle number exceed exception e.printStackTrace(); } catch (IOException e) { // To handle IO exception e.printStackTrace(); } AnalyticModel analysis = new AnalyticModel(); analysis.findLowest(lab2); // Find the lowest of 5 quizzes among 40 students analysis.findHighest(lab2); // Find the highest of 5 quizzes among 40 students analysis.findAvg(lab2); // Find the average of 5 quizzes among 40 students System.out.println("Stud\tQu1\tQu2\tQu3\tQu4\tQu5"); // Display grades information while (lab2[count] != null) { lab2[count].displayInfo(); // Display students information count++; if (count == 40) break; } analysis.displayGrades(); // Display analytic statistics }
/** * Main method * * @param args Command line arguments */ public static void main(String[] args) { int tileSize = 20; int fieldWidth = 100; int fieldHeight = 100; Dimension windowSize = new Dimension(1000, 800); Field f = new Field(fieldWidth, fieldHeight, "random"); // randomCircles(f, fieldWidth*fieldHeight/50, 3); f.setTile(new Vector2D(40.5, 40.5), 4); f.setTile(new Vector2D(40.5, 41.5), 4); Vector2D start = new Vector2D(35, 41); // Vector2D start = findStartPos(f); byte[] fi = null; try { fi = Util.readFile("savedmap"); } catch (IOException e) { System.out.println("I/O error."); } f = MapCodec.decode(fi); /*byte[] m = MapCodec.encode(f); try { Util.writeFile("testmap", m); } catch (IOException e) { System.out.println("I/O error."); }*/ ArrayList<Team> teams = new ArrayList<Team>(); teams.add(new Team("SWAR", 0)); teams.add(new Team("sWARm", 1)); Session game = (Session) new GameSession(start, teams, 0); Session editor = (Session) new EditorSession(); BFrame frame = new BFrame(windowSize); Dimension paneSize = frame.getContentPane().getSize(); OpenGLRenderer renderer = new OpenGLRenderer(editor, tileSize, frame); Core.field = f; Core.input = new Input(frame); Core.view = new View(paneSize, tileSize); Core.initialize((Session) editor, (Session) game); // game.entitySystem.addAll(randomTowers(f, 30, game,teams)); MainLoop.startLoop(renderer, frame); }