Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

saved #49

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
/**
* Created by leon on 1/31/18.
*/

// saved
public class MainApp {
public static void main(String[] args) {


}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,73 @@

public class NumberUtilities {
public static String getEvenNumbers(int start, int stop) {
return null;

StringBuilder myString = new StringBuilder();


for (int i = start; i < stop; i += 2) {
myString.append(i);
}

return myString.toString();


}


public static String getOddNumbers(int start, int stop) {
return null;

StringBuilder myString = new StringBuilder();


for (int i = start; i < stop; i += 2) {
myString.append(i);
}

return myString.toString();

}


public static String getSquareNumbers(int start, int stop, int step) {
return null;


StringBuilder myString = new StringBuilder();


for (int i = start; i < stop; i += step) {
myString.append(i * i);

}

return myString.toString();

}


public static String getRange(int start, int stop, int step) {
return null;

StringBuilder myString = new StringBuilder();

for (int i = start; i < stop; i += step) {
myString.append(i);
}

return myString.toString();
}


public static String getExponentiations(int start, int stop, int step, int exponent) {
return null;

StringBuilder myString = new StringBuilder();


for (int i = start; i < stop; i += step) {
myString.append((long)(Math.pow(i, 2)));

}

return myString.toString();

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,63 @@

public class TableUtilities {
public static String getSmallMultiplicationTable() {
return null;

StringBuilder myString = new StringBuilder();

for (int i = 1; i < 6; i++) {

for (int j = 1; j < 6; j++) {

myString.append(String.format("%3d |", i * j));


}

myString.append("\n");

}

return myString.toString();

}

public static String getLargeMultiplicationTable() {
return null;

StringBuilder myString = new StringBuilder();

for (int i = 1; i < 11; i++) {

for (int j = 1; j < 11; j++) {

myString.append(String.format("%3d |", i*j));

}

myString.append("\n");

}

return myString.toString();

}

public static String getMultiplicationTable(int tableSize) {
return null;

StringBuilder myString = new StringBuilder();

for (int i = 1; i <= tableSize; i++) {

for (int j = 1; j <= tableSize; j++) {

myString.append(String.format("%3d |", i*j));

}

myString.append("\n");

}

return myString.toString();

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,65 @@
public class TriangleUtilities {

public static String getTriangle(int numberOfRows) {
return null;

StringBuilder myString = new StringBuilder();

for (int i = 1; i < numberOfRows; i++) {

for (int j = 0; j < i; j++) {
myString.append("*");

}
myString.append("\n");
}

return myString.toString();
}

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

StringBuilder myString = new StringBuilder();

for (int i = 0; i < numberOfStars; i++) {
myString.append("*");
}

return myString.toString();

}

public static String getSmallTriangle() {
return null;

StringBuilder myString = new StringBuilder();

for (int i = 0; i <= 3; i++) {

for (int j = 0; j < i; j++) {
myString.append("*");

}
myString.append("*\n");

}

return myString.toString();
}

public static String getLargeTriangle() {
return null;

StringBuilder myString = new StringBuilder();

for (int i = 0; i <= 8; i++) {

for (int j = 0; j < i; j++) {
myString.append("*");
}

myString.append("*\n");

}

return myString.toString();

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public void testGetEvenNumbers() {
@Test
public void testGetOddNumbers() {
// : Given
String expected = "681012141618";
String expected = "5791113151719";
int start = 5;
int stop = 20;
int step = 5;
Expand Down