Display order of boats per event
This commit is contained in:
parent
21487340ab
commit
987dcdac01
Generated
+40
-2
@@ -1,5 +1,43 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ClientPropertiesManager">
|
||||
<properties class="javax.swing.AbstractButton">
|
||||
<property name="hideActionText" class="java.lang.Boolean" />
|
||||
</properties>
|
||||
<properties class="javax.swing.JComponent">
|
||||
<property name="html.disable" class="java.lang.Boolean" />
|
||||
</properties>
|
||||
<properties class="javax.swing.JEditorPane">
|
||||
<property name="JEditorPane.w3cLengthUnits" class="java.lang.Boolean" />
|
||||
<property name="JEditorPane.honorDisplayProperties" class="java.lang.Boolean" />
|
||||
<property name="charset" class="java.lang.String" />
|
||||
</properties>
|
||||
<properties class="javax.swing.JList">
|
||||
<property name="List.isFileList" class="java.lang.Boolean" />
|
||||
</properties>
|
||||
<properties class="javax.swing.JPasswordField">
|
||||
<property name="JPasswordField.cutCopyAllowed" class="java.lang.Boolean" />
|
||||
</properties>
|
||||
<properties class="javax.swing.JSlider">
|
||||
<property name="Slider.paintThumbArrowShape" class="java.lang.Boolean" />
|
||||
<property name="JSlider.isFilled" class="java.lang.Boolean" />
|
||||
</properties>
|
||||
<properties class="javax.swing.JTable">
|
||||
<property name="Table.isFileList" class="java.lang.Boolean" />
|
||||
<property name="JTable.autoStartsEdit" class="java.lang.Boolean" />
|
||||
<property name="terminateEditOnFocusLost" class="java.lang.Boolean" />
|
||||
</properties>
|
||||
<properties class="javax.swing.JToolBar">
|
||||
<property name="JToolBar.isRollover" class="java.lang.Boolean" />
|
||||
</properties>
|
||||
<properties class="javax.swing.JTree">
|
||||
<property name="JTree.lineStyle" class="java.lang.String" />
|
||||
</properties>
|
||||
<properties class="javax.swing.text.JTextComponent">
|
||||
<property name="caretAspectRatio" class="java.lang.Double" />
|
||||
<property name="caretWidth" class="java.lang.Integer" />
|
||||
</properties>
|
||||
</component>
|
||||
<component name="MavenProjectsManager">
|
||||
<option name="originalFiles">
|
||||
<list>
|
||||
@@ -7,7 +45,7 @@
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8 (1)" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
<component name="SvnConfiguration">
|
||||
@@ -17,7 +55,7 @@
|
||||
<states>
|
||||
<state key="ProjectJDKs.UI">
|
||||
<settings>
|
||||
<last-edited>1.8 (1)</last-edited>
|
||||
<last-edited>1.8</last-edited>
|
||||
<splitter-proportions>
|
||||
<option name="proportions">
|
||||
<list>
|
||||
|
||||
@@ -8,7 +8,10 @@ public class App
|
||||
Boat boat1 = new Boat("New Zealand");
|
||||
Boat boat2 = new Boat("America");
|
||||
Boat[] boats = {boat1, boat2};
|
||||
Event event = new Event(boats);
|
||||
System.out.println(event.getParticipants());
|
||||
Event start = new Event("Start", boats);
|
||||
Event finish = new Event("Finish", boats);
|
||||
|
||||
System.out.println(start);
|
||||
System.out.println(finish);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,23 +2,31 @@ package seng302;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
|
||||
/**
|
||||
* Created by fwy13 on 3/03/17.
|
||||
*/
|
||||
public class Event {
|
||||
private String name;
|
||||
private ArrayList<Boat> boats;
|
||||
|
||||
public Event(Boat boats[]){
|
||||
public Event(String name, Boat boats[]){
|
||||
this.name = name;
|
||||
this.boats = new ArrayList<>(Arrays.asList(boats));
|
||||
|
||||
if(this.name != "Start") {
|
||||
Collections.shuffle(this.boats);
|
||||
}
|
||||
}
|
||||
|
||||
public String getParticipants(){
|
||||
String participants = "";
|
||||
public String toString() {
|
||||
String event = name + "\n\n";
|
||||
|
||||
for(int i = 0; i < boats.size(); i++) {
|
||||
participants += boats.get(i).getName()+"\n";
|
||||
}
|
||||
return participants;
|
||||
event += i+1 + ". " + boats.get(i).getName()+"\n";
|
||||
}
|
||||
|
||||
return event;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user