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

Program Works #23

Open
wants to merge 1 commit 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
60 changes: 53 additions & 7 deletions NumberUtilities.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,75 @@
public class NumberUtilities {

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

for (int x = 0; x < stop; x++){
result = result + Integer.toString(x);
}
return result;
}

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

for (int x = start; x < stop; x++){
result = result + Integer.toString(x);
}
return result;
}


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

for (int x = start; x < stop; x++){

if( x % step == 0 ){
result = result + Integer.toString(x);
}
}
return result;
}

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

for (int x = start; x < stop; x++){

if( x % 2 == 0 ){
result = result + Integer.toString(x);
}
}
return result;
}


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

for (int x = start; x < stop; x++){

if( x % 2 != 0 ){
result = result + Integer.toString(x);
}
}
return result;
}


public static String getExponentiations(int start, int stop, int exponent) {
return null;
String result = "";
int num = 0;

for (int x = start; x <= stop; x++){

num = x;

for(int y = 1; y < exponent; y++){
num = num * x ;
}

result = result + Integer.toString(num);
}
return result;
}
}
20 changes: 16 additions & 4 deletions TableUtilities.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@


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

public static String getLargeMultiplicationTable() {
return null;
return getMultiplicationTable(10);
}

public static String getMultiplicationTable(int tableSize) {
return null;
String result = "";
int num;

for( int row = 1; row <= tableSize; row++){
for( int times = 1; times <= tableSize; times++){
num = row * times;
result+= String.format("%3d", num) + " |";

}
result = result + "\n";
}

return result;
}
}
23 changes: 17 additions & 6 deletions TriangleUtilities.java
Original file line number Diff line number Diff line change
@@ -1,21 +1,32 @@


public class TriangleUtilities {

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

for (int x = 0; x < numberOfStars; x++){
result = result + "*";
}
return result;
}

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

for (int row = 1; row < numberOfRows + 1 ; row++){
for(int stars = 0; stars < row; stars++){
result = result + "*";
}
result = result + "\n";
}
return result;
}


public static String getSmallTriangle() {
return null;
return getTriangle(4);
}

public static String getLargeTriangle() {
return null;
return getTriangle(9);
}
}
38 changes: 19 additions & 19 deletions package.bluej
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
#BlueJ package file
dependency1.from=NumberUtilitiesTest
dependency1.to=NumberUtilities
dependency1.from=TriangleUtilitiesTest
dependency1.to=TriangleUtilities
dependency1.type=UsesDependency
dependency2.from=TriangleUtilitiesTest
dependency2.to=TriangleUtilities
dependency2.from=TableUtilitiesTest
dependency2.to=TableUtilities
dependency2.type=UsesDependency
dependency3.from=TableUtilitiesTest
dependency3.to=TableUtilities
dependency3.from=NumberUtilitiesTest
dependency3.to=NumberUtilities
dependency3.type=UsesDependency
editor.fx.0.height=722
editor.fx.0.width=800
editor.fx.0.x=537
editor.fx.0.y=28
objectbench.height=164
objectbench.width=484
editor.fx.0.height=1016
editor.fx.0.width=1267
editor.fx.0.x=198
editor.fx.0.y=-1041
objectbench.height=154
objectbench.width=435
package.divider.horizontal=0.6
package.divider.vertical=0.7560627674750356
package.editor.height=523
package.editor.width=382
package.editor.x=20
package.editor.y=57
package.frame.height=759
package.frame.width=508
package.divider.vertical=0.825
package.editor.height=752
package.editor.width=341
package.editor.x=0
package.editor.y=0
package.frame.height=978
package.frame.width=459
package.numDependencies=3
package.numTargets=6
package.showExtends=true
Expand Down