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
72 changes: 62 additions & 10 deletions NumberUtilities.java
Original file line number Diff line number Diff line change
@@ -1,32 +1,84 @@



public class NumberUtilities {

public static String getRange(int stop) {
return null;
String outcome = "";
String convert;

for (int i = 0; i < stop; i++) {
convert = Integer.toString(i);
outcome += convert;
}

return outcome;
}

public static String getRange(int start, int stop) {
return null;
String outcome = "";
String convert;

for (int i = start; i < stop; i++) {
convert = Integer.toString(i);
outcome += convert;
}

return outcome;
}


public static String getRange(int start, int stop, int step) {
return null;
String outcome = "";
String convert;

for (int i = start; i < stop;) {
convert = Integer.toString(i);
outcome += convert;
i += step;
}

return outcome;
}

public static String getEvenNumbers(int start, int stop) {
return null;
String outcome = "";
String convert;

for (int i = start; i < stop; i++) {
if (i % 2 == 0) {
convert = Integer.toString(i);
outcome += convert;
}
}

return outcome;
}


public static String getOddNumbers(int start, int stop) {
return null;
String outcome = "";
String convert;

for (int i = start; i < stop; i++) {
if (i % 2 != 0) {
convert = Integer.toString(i);
outcome += convert;
}
}

return outcome;
}


public static String getExponentiations(int start, int stop, int exponent) {
return null;
String outcome = "";
String convert;
int exponentials;

for (int i = start; i <= stop; i++) {
exponentials = (int)Math.pow(i, exponent);
convert = Integer.toString(exponentials);
outcome += convert;
}

return outcome;
}
}
}
99 changes: 92 additions & 7 deletions TableUtilities.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,100 @@


public class TableUtilities {
public class TableUtilities {
public static String getSmallMultiplicationTable() {
return null;
String outcome = "";
String convert;
int multiple;

for (int i = 1; i <= 5; i++) {
for (int j = 1; j <= 5; j++) {
multiple = i * j;
convert = Integer.toString(multiple);

if (multiple >= 10) {
if (j == 5) {
outcome += " " + convert + " |\n";
} else {
outcome += " " + convert + " |";
}
} else {
if (j == 5) {
outcome += " " + convert + " |\n";
} else {
outcome += " " + convert + " |";
}
}
}
}

return outcome;
}

public static String getLargeMultiplicationTable() {
return null;
String outcome = "";
String convert;
int multiple;

for (int i = 1; i <= 10; i++) {
for (int j = 1; j <= 10; j++) {
multiple = i * j;
convert = Integer.toString(multiple);

if (multiple >= 100) {
if (j == 10) {
outcome += "" + convert + " |\n";
} else {
outcome += "" + convert + " |";
}
} else if (multiple >= 10){
if (j == 10) {
outcome += " " + convert + " |\n";
} else {
outcome += " " + convert + " |";
}
} else {
if (j == 10) {
outcome += " " + convert + " |\n";
} else {
outcome += " " + convert + " |";
}
}
}
}

return outcome;
}

public static String getMultiplicationTable(int tableSize) {
return null;
String outcome = "";
String convert;
int multiple;

for (int i = 1; i <= tableSize; i++) {
for (int j = 1; j <= tableSize; j++) {
multiple = i * j;
convert = Integer.toString(multiple);

if (multiple >= 100) {
if (j == tableSize) {
outcome += "" + convert + " |\n";
} else {
outcome += "" + convert + " |";
}
} else if (multiple >= 10){
if (j == tableSize) {
outcome += " " + convert + " |\n";
} else {
outcome += " " + convert + " |";
}
} else {
if (j == tableSize) {
outcome += " " + convert + " |\n";
} else {
outcome += " " + convert + " |";
}
}
}
}

return outcome;
}
}
}
42 changes: 33 additions & 9 deletions TriangleUtilities.java
Original file line number Diff line number Diff line change
@@ -1,21 +1,45 @@


public class TriangleUtilities {
public class TriangleUtilities {

public static String getRow(int numberOfStars) {
return null;
String outcome = "";

for (int i = 0; i < numberOfStars; i++) {
outcome += "*";
}

return outcome;
}

public static String getTriangle(int numberOfRows) {
return null;
}
String outcome = "";
String stars = "*";

for (int i = 1; i <= numberOfRows; i++) {
outcome += stars.repeat(i) + "\n";
}

return outcome;
}

public static String getSmallTriangle() {
return null;
String outcome = "";
String stars = "*";

for (int i = 1; i <= 4; i++) {
outcome += stars.repeat(i) + "\n";
}

return outcome;
}

public static String getLargeTriangle() {
return null;
String outcome = "";
String stars = "*";

for (int i = 1; i <= 9; i++) {
outcome += stars.repeat(i) + "\n";
}

return outcome;
}
}
}
Loading