Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions src/main/java/com/dtcc/exams/part1/BasicUtilities.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,32 @@
public class BasicUtilities {

public Boolean isGreaterThan5(Integer value) {
return null;
if (value < 5) {
return false;
} else {
return true;
}
}

public Boolean isLessThan7(Integer value) {
return null;
if (value <= 7) {
return true;
} else {
return false;
}
}

public Boolean isBetween5And7(Integer valueToEvaluate) {
return null;
if (valueToEvaluate <= 7 && valueToEvaluate >= 5) {
return true;
} else {
return false;
}
}

public Boolean startsWith(String string, Character character) {
return null;

return false;
}
}

}
27 changes: 23 additions & 4 deletions src/main/java/com/dtcc/exams/part1/DelTechConcatenator.java
Original file line number Diff line number Diff line change
@@ -1,20 +1,39 @@
package com.dtcc.exams.part1;

import java.util.Scanner;
public class DelTechConcatenator {

Scanner scan = new Scanner(System.in);
int input = 0;
public DelTechConcatenator(Integer input) {
input = scan.nextInt();
int count = 0;
for(int i = 1; i <= input; i++){
count++;
}
}

public Boolean isDel() {
return null;
if(input % 3 == 0){
return true;
}else {
return false;
}
}

public Boolean isTech() {
return null;
if(input % 5 == 0) {
return true;
}else {
return false;
}
}

public Boolean isDelTech() {
return null;
if(input % 3 == 0 && input % 5 == 0){
return true;
}else {
return false;
}
}

}
13 changes: 9 additions & 4 deletions src/main/java/com/dtcc/exams/part1/IntegerArrayUtilities.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,24 @@
public class IntegerArrayUtilities {

public Boolean hasEvenLength(Integer[] array) {
return null;
if (array.length % 2 != 0) {
return false;
}return true;
}

public Integer[] range(int start, int stop) {

return null;
}

public Integer getSumOfFirstTwo(Integer[] array) {
return null;
int sum = array[0] + array[1];
return sum;
}

public Integer getProductOfFirstTwo(Integer[] array) {
return null;
int product = array.length * array.length-1;

return product;
}

}
14 changes: 14 additions & 0 deletions src/main/java/com/dtcc/exams/part2/ArrayUtility.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
package com.dtcc.exams.part2;

import java.util.Arrays;

public class ArrayUtility {

public Integer[] merge(Integer[] array1, Integer[] array2) {
int firstArray = array1.length;
int secondArray = array2.length;
int count = 0;
int[] result = new int [firstArray + secondArray];
for(int i = 0; i < array1.length; i++) {
result[i] = array1[i];
count++;
}
for(int j = 0; j < array2.length; j++){
result[count++] = array2[j];
}
return null;
}

public Integer[] rotate(Integer[] array, Integer index) {

return null;
}

Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/dtcc/exams/part2/ListUtility.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
public class ListUtility {

public Boolean add(int i) {

return null;
}

Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/dtcc/exams/part3/Animal.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ public interface Animal {
int getSpeed();
String color();



}
12 changes: 11 additions & 1 deletion src/main/java/com/dtcc/exams/part3/Bird.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
package com.dtcc.exams.part3;

public class Bird {
public class Bird implements Animal {

public String move() {
String move = "fly";
return move;
}

public int getSpeed() {
return 0;
}

public String color() {
return null;
}


public void setMigrationMonth(String expected) {

}
Expand Down
20 changes: 19 additions & 1 deletion src/main/java/com/dtcc/exams/part3/Horse.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
package com.dtcc.exams.part3;

public class Horse {
public class Horse implements Animal {


public String move() {
String move = "gallop";
return move;
}


public int getSpeed() {
int speed = 40;
return speed;
}


public String color() {
String color = "black";
return color;
}
}
12 changes: 11 additions & 1 deletion src/main/java/com/dtcc/exams/part3/PeregrineFalcon.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
package com.dtcc.exams.part3;

public class PeregrineFalcon {
public class PeregrineFalcon extends Bird{

public String color() {
String color = "brown";
return color;
}
public int getSpeed() {
int speed = 13;
return speed;
}

}
27 changes: 26 additions & 1 deletion src/main/java/com/dtcc/exams/part3/RedRobin.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,29 @@
package com.dtcc.exams.part3;

public class RedRobin {
public class RedRobin extends Bird{

public String color() {
String color = "red";
return color;
}

public int getSpeed() {
int speed = 10;
return speed;
}

public String migrationMonth() {

return null;
}

public String getMigrationMonth() {
String migrationMonth = "August";
return migrationMonth;
}

public void setMigrationMonth(String expected) {

}

}
9 changes: 8 additions & 1 deletion src/main/java/com/dtcc/exams/part3/SpeedComparator.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
package com.dtcc.exams.part3;

public class SpeedComparator {
public class SpeedComparator implements Comparable<Animal> {

int speed;

public int compareTo(Animal animal1) {

return 0;
}
}