Commit ae42b62
Changed files (9)
src/Q10/TrainTimeTable.java
@@ -19,7 +19,10 @@ public class TrainTimeTable {
this(new LinkedList<Station>());
}
- /** An overloaded constructor to allow injections of each of the stations in the schedule. */
+ /**
+ * An overloaded constructor to allow injections of each of the stations in the schedule.
+ * @param schedule the list of stations
+ * */
public TrainTimeTable(LinkedList<Station> schedule) {
this.schedule = schedule;
}
@@ -49,6 +52,7 @@ public class TrainTimeTable {
/**
* An overload of displaySchedule that accepts a PrintStream to write output to different
* printers.
+ * @param out the output stream to write to
*/
public void displaySchedule(PrintStream out) {
out.println(String.format("%15s | %7s | %9s | %3s", "Station", "Arrival", "Departure", "Day"));
@@ -72,7 +76,10 @@ public class TrainTimeTable {
return null;
}
- /** This is the main entry point to the console application. */
+ /**
+ * This is the main entry point to the console application.
+ * @param args the argument vector to passed to the program.
+ * */
public static void main(String[] args) {
System.out.println("=== Question 10 ===");
LinkedList<Station> stations =
src/Q4/RandomSumGame.java
@@ -131,7 +131,7 @@ public class RandomSumGame {
/**
* The entry point to the console application.
*
- * @params args the command line arguments passed to the program
+ * @param args the command line arguments passed to the program
*/
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
src/Q5/Citizen.java
@@ -70,6 +70,7 @@ public class Citizen {
/**
* Converts an integer to a string.
*
+ * @param i the integer to convert to a string
* @return the converted integer as a string.
*/
public static String convert(int i) {
src/Q5/ComputeIntellect.java
@@ -53,7 +53,10 @@ public class ComputeIntellect {
return this.undergraduate;
}
- /** Tallys the # of citizens with different educational qualifications. */
+ /**
+ * Tallys the # of citizens with different educational qualifications.
+ * @param citizens the array of citizens to tally.
+ * */
public void distributionOfQualification(Citizen[] citizens) {
for (Citizen citizen : citizens)
switch (citizen.getEducationalQualification()) {
src/Q5/Village.java
@@ -20,7 +20,10 @@ public class Village {
this(new ArrayList<Citizen>());
}
- /** Creates an instance of a village with specific villagers. */
+ /**
+ * Creates an instance of a village with specific villagers.
+ * @param citizens the list of citizens in the village
+ */
public Village(List<Citizen> citizens) {
this.citizens = citizens;
}
@@ -30,7 +33,10 @@ public class Village {
return this.citizens.size();
}
- /** Adds a citizen to the village with a specific qualification. */
+ /**
+ * Adds a citizen to the village with a specific qualification.
+ * @param qualification the qualification for the citizen
+ * */
public void addCitizen(int qualification) {
this.citizens.add(new Citizen(Citizen.generateId(), qualification));
}
@@ -45,7 +51,10 @@ public class Village {
return this.citizens.toArray(new Citizen[this.citizens.size()]);
}
- /** The entry point to the console application. */
+ /**
+ * The entry point to the console application.
+ * @param args the argument vector given to the program.
+ * */
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
Village village = new Village();
src/Q6/WeekDay.java
@@ -21,6 +21,7 @@ public class WeekDay {
* @param day the day of the month
* @param month the month of the year
* @param year the year
+ * @return the name of the day of the week. (Sunday to Saturday)
*/
public String getWeekDay(int day, int month, int year) {
this.ensureValidDate(year, month, day);
@@ -53,7 +54,10 @@ public class WeekDay {
throw new IllegalArgumentException();
}
- /** The entry point to the console application. */
+ /**
+ * The entry point to the console application.
+ * @param args the argument vector given to the program.
+ * */
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
src/Q7/Person.java
@@ -130,7 +130,10 @@ public class Person {
this.setBMI((this.weight * 703) / Math.pow(height, 2));
}
- /** The entry point to the console application. */
+ /**
+ * The entry point to the console application.
+ * @param args the argument vector passed to the program.
+ **/
public static void main(String[] args) {
ArrayList<Person> people = new ArrayList<Person>();
people.add(new Person("Andrew", 125.5, 55.1));
src/Q9/MovingRobot.java
@@ -28,7 +28,7 @@ public class MovingRobot extends Robot {
/**
* Checks to see if a robot can advance in the direction provided.
*
- * @param the direction that a robot wants to advance to.
+ * @param direction the direction that a robot wants to advance to.
* @return returns true if the robot can advance to the given direction.
*/
public boolean validateNextMove(int direction) {
@@ -59,7 +59,11 @@ public class MovingRobot extends Robot {
return this.rng.nextInt(7) + 1;
}
- /** @return true if the two robots are in the same coordinate. */
+ /**
+ * @param r1 robot 1
+ * @param r2 robot 2
+ * @return true if the two robots are in the same coordinate.
+ */
public static boolean sameSlot(Robot r1, Robot r2) {
return r1.getX() == r2.getX() && r1.getY() == r2.getY();
}
src/Q9/Robot.java
@@ -66,7 +66,11 @@ public class Robot {
this.y = y;
}
- /** @return true if the robot is at the given coordinate */
+ /**
+ * @param x the x coordinate
+ * @param y the y coordinate
+ * @return true if the robot is at the given coordinate
+ * */
public boolean atPosition(int x, int y) {
return getX() == x && getY() == y;
}