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
29 changes: 21 additions & 8 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 true; }
else return false ;
}

public Boolean isLessThan7(Integer value) {
return null;
}

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

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

// Not included in the Part 1 specifications
public Boolean startsWith(String string, Character character) {
return null;
}
boolean startsWith = false;
String strCheck = string.charAt(0) + "";
String strChar = character + "";
if(strCheck.equalsIgnoreCase(strChar)){
startsWith = true;}
return startsWith;

}

}
24 changes: 19 additions & 5 deletions src/main/java/com/dtcc/exams/part1/DelTechConcatenator.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,33 @@

public class DelTechConcatenator {

Integer input;
public DelTechConcatenator(Integer input) {
this.input=input;
}

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

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

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

}

}

}

27 changes: 21 additions & 6 deletions src/main/java/com/dtcc/exams/part1/IntegerArrayUtilities.java
Original file line number Diff line number Diff line change
@@ -1,21 +1,36 @@
package com.dtcc.exams.part1;

import java.util.*;
public class IntegerArrayUtilities {

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

public Integer[] range(int start, int stop) {
return null;
ArrayList<Integer> range = new ArrayList<>();
for (int i = start; i < stop; i++) {
range.add(i);
}
Integer[] rangeArray=new Integer[range.size()];
for(int i=0;i<rangeArray.length;i++){
rangeArray[i]=(Integer)range.get(i);}
return rangeArray;
}

public Integer getSumOfFirstTwo(Integer[] array) {
return null;
// Not included in the Part 1 specifications
public Integer getSumOfFirstTwo(Integer[] array) {
Integer sum;
sum = array[0] + array[1];

return sum;
}

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

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>