Initial Commit

This commit is contained in:
2022-10-07 00:22:46 -03:00
commit bdcf6d3e1c
465 changed files with 15466 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

View File

@ -0,0 +1,54 @@
Enter test score: 12
Enter test score: 23
Enter test score: 34
Enter test score: 56
Enter test score: 67
Enter test score: 89
Enter test score: 90
Enter test score: 21
Enter test score: 43
Enter test score: 54
Enter test score: 65
Enter test score: 76
Enter test score: 87
Enter test score: 98
Enter test score: 09
Enter test score: 49
Enter test score: 28
Enter test score: 48
Enter test score: 43
Enter test score: 86
Enter test score: 23
Enter test score: 765
Please enter a test score within the range 0-100
Enter test score: 54
Enter test score: 65
Enter test score: 32
Enter test score: 73
Enter test score: 96
Enter test score: 62
Enter test score: 74
Enter test score: 52
Enter test score: 52
Enter test score: 74
Enter test score: 52
Enter test score: 74
Enter test score: 52
Enter test score: 75
Enter test score: 2
Enter test score: 74
Enter test score: 41
Enter test score: 74
Enter test score: 41
Enter test score: 63
Enter test score: 41
Enter test score: -1
Scores
A |******
B |********
C |******
D |********
F |**************
===============================
+ + + +
0 10 20 30

View File

@ -0,0 +1,70 @@
Enter test score: 12
Enter test score: 34
Enter test score: 56
Enter test score: 78
Enter test score: 90
Enter test score: 09
Enter test score: 87
Enter test score: 65
Enter test score: 43
Enter test score: 21
Enter test score: 13
Enter test score: 35
Enter test score: 7
Enter test score: 75
Enter test score: 42
Enter test score: 65
Enter test score: 42
Enter test score: 86
Enter test score: 432
Please enter a test score within the range 0-100
Enter test score: 73
Enter test score: 95
Enter test score: 05
Enter test score: 15
Enter test score: 73
Enter test score: 53
Enter test score: 86
Enter test score: 53
Enter test score: 86
Enter test score: 52
Enter test score: 85
Enter test score: 53
Enter test score: 86
Enter test score: 27
Enter test score: 73
Enter test score: 52
Enter test score: 85
Enter test score: -1
30+ |
|
|
|
|
|
|
|
|
|
20+ |
|
|
|
|
|
|
| *
| *
| *
10+ | *
| * *
| * *
| * *
| * *
| * * * *
| * * * *
| * * * * *
| * * * * *
| * * * * *
0+ ===========
A B C D F

View File

@ -0,0 +1,8 @@
These are the original strings
[1, 4, 9, 16]
[9, 7, 4, 9, 11]
[1, 4, 9, 16, 9, 7, 4, 9, 11]
These are the modified strings
[1, 4, 9, 16, 9, 7, 4, 9, 11]
[11, 9, 4, 7, 9, 16, 9, 4, 1]
-2

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

View File

@ -0,0 +1,50 @@
import java.util.Scanner;
/**
* Simple test stats
* @author Isaac Shoebottom (3429069)
*/
public class ClassGrades {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
long testScore;
long numberOfA = 0;
long numberOfB = 0;
long numberOfC = 0;
long numberOfD = 0;
long numberOfF = 0;
do {
System.out.print("Enter test score: ");
testScore = scan.nextLong();
if (testScore > 100) {
System.out.println("Please enter a test score within the range 0-100");
}
else {
if (testScore >= 85) {
numberOfA++;
}
else if (testScore >= 70) {
numberOfB++;
}
else if (testScore >= 55) {
numberOfC++;
}
else if (testScore >= 45) {
numberOfD++;
}
else if (testScore >= 0) {
numberOfF++;
}
}
} while (testScore >= 0);
System.out.println("Number of A's: " + numberOfA);
System.out.println("Number of B's: " + numberOfB);
System.out.println("Number of C's: " + numberOfC);
System.out.println("Number of D's: " + numberOfD);
System.out.println("Number of F's: " + numberOfF);
}
}

View File

@ -0,0 +1,74 @@
import java.util.Scanner;
/**
* Sideways histogram for tests
* @author Isaac Shoebottom (3429069)
*/
public class ClassGradesHistogram {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
long testScore;
long numberOfA = 0;
long numberOfB = 0;
long numberOfC = 0;
long numberOfD = 0;
long numberOfF = 0;
do {
System.out.print("Enter test score: ");
testScore = scan.nextLong();
if (testScore > 100) {
System.out.println("Please enter a test score within the range 0-100");
} else {
if (testScore >= 85) {
numberOfA++;
} else if (testScore >= 70) {
numberOfB++;
} else if (testScore >= 55) {
numberOfC++;
} else if (testScore >= 45) {
numberOfD++;
} else if (testScore >= 0) {
numberOfF++;
}
}
} while (testScore >= 0);
System.out.println("Scores");
System.out.print("A\t\t|");
while (numberOfA > 0) {
System.out.print('*');
numberOfA--;
}
System.out.println();
System.out.print("B\t\t|");
while (numberOfB > 0) {
System.out.print('*');
numberOfB--;
}
System.out.println();
System.out.print("C\t\t|");
while (numberOfC > 0) {
System.out.print('*');
numberOfC--;
}
System.out.println();
System.out.print("D\t\t|");
while (numberOfD > 0) {
System.out.print('*');
numberOfD--;
}
System.out.println();
System.out.print("F\t\t|");
while (numberOfF > 0) {
System.out.print('*');
numberOfF--;
}
System.out.println();
System.out.println("\t\t" + "===============================");
System.out.println("\t\t" + "+ + + +");
System.out.println("\t\t" + "0 10 20 30");
}
}

View File

@ -0,0 +1,82 @@
import java.util.Scanner;
/**
* Vertical histogram for tests
* @author Isaac Shoebottom (3429069)
*/
public class ClassGradesHistogramVertical {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
long testScore;
long numberOfA = 0;
long numberOfB = 0;
long numberOfC = 0;
long numberOfD = 0;
long numberOfF = 0;
do {
System.out.print("Enter test score: ");
testScore = scan.nextLong();
if (testScore > 100) {
System.out.println("Please enter a test score within the range 0-100");
} else {
if (testScore >= 85) {
numberOfA++;
} else if (testScore >= 70) {
numberOfB++;
} else if (testScore >= 55) {
numberOfC++;
} else if (testScore >= 45) {
numberOfD++;
} else if (testScore >= 0) {
numberOfF++;
}
}
} while (testScore >= 0);
for (int i = 30; i > 0; i--) {
if (i == 30 | i == 20 | i == 10)
System.out.print(i+ "+");
System.out.print("\t| ");
if (numberOfA >= i) {
System.out.print('*');
}
else {
System.out.print(' ');
}
System.out.print(' ');
if (numberOfB >= i) {
System.out.print('*');
}
else {
System.out.print(' ');
}
System.out.print(' ');
if (numberOfC >= i) {
System.out.print('*');
}
else {
System.out.print(' ');
}
System.out.print(' ');
if (numberOfD >= i) {
System.out.print('*');
}
else {
System.out.print(' ');
}
System.out.print(' ');
if (numberOfF >= i) {
System.out.print('*');
}
else {
System.out.print(' ');
}
System.out.print(' ');
System.out.println();
}
System.out.println("0+\t===========");
System.out.println("\t A B C D F");
}
}

View File

@ -0,0 +1,67 @@
/**
* Array utils for ints
* @author Isaac Shoebottom (3429069)
*/
public class IntArrayUtil {
/**
* Appends an array to another array
* @param arrA First array in append
* @param arrB Second array in append
* @return Appended array
*/
public static int[] append (int[] arrA, int[] arrB) {
int appendedLength = arrA.length + arrB.length;
int[] appended = new int[appendedLength];
for(int i = 0; i < arrA.length; i++) {
appended[i] = arrA[i];
}
for(int i = 0; i < arrB.length; i++) {
appended[i + arrA.length] = arrB[i];
}
return appended;
}
/**
* Reverse the order of elements in a string
* @param arr The array to be reversed
* @return The reversed array
*/
public static int[] reverse (int[] arr) {
int[] reversed = new int[arr.length];
for(int i =0; i<arr.length; i++ ) {
reversed[i] = arr[i];
}
for(int i = 0; i < arr.length/2; i++) {
int temp = reversed[i];
reversed[i] = arr[(arr.length-1) - i];
reversed[(arr.length-1) - i] = temp;
}
return reversed;
}
/**
* Subtracts every odd index from a string from every even index
* @param arr The array to perform math on
* @return The alternating sum of the array
*/
public static int alternatingSum (int[] arr) {
int positives = 0;
int negatives = 0;
boolean isPos = true;
for (int j : arr)
if (isPos) {
positives += j;
isPos = false;
} else {
negatives += j;
isPos = true;
}
return positives-negatives;
}
}

View File

@ -0,0 +1,21 @@
import java.util.Arrays;
public class IntArrayUtilDriver {
public static void main(String[] args) {
int[] array1 = {1, 4 ,9, 16};
int[] array2 = {9, 7, 4, 9 ,11};
int[] array3 = IntArrayUtil.append(array1, array2);
System.out.println("These are the original strings");
System.out.println(Arrays.toString(array1));
System.out.println(Arrays.toString(array2));
System.out.println(Arrays.toString(array3));
System.out.println("These are the modified strings");
System.out.println(Arrays.toString(IntArrayUtil.append(array1, array2)));
System.out.println(Arrays.toString(IntArrayUtil.reverse(array3)));
System.out.println(IntArrayUtil.alternatingSum(array3));
}
}

View File

@ -0,0 +1,19 @@
/**
* Inverted Stairs
* @author Isaac Shoebottom (3429069)
*/
public class PatternInverted {
public static void main(String[] args) {
for (int i = 1; i < 10; i++) {
for (int a = 9; a > i; a--) {
System.out.print(' ');
}
for (int j = 1; j <= i; j++) {
System.out.print('*');
}
System.out.println();
}
}
}