Skip to content

Commit

Permalink
feat: add a test class method
Browse files Browse the repository at this point in the history
  • Loading branch information
gabriel-logan committed Apr 1, 2024
1 parent fa767e1 commit 2dd66ad
Show file tree
Hide file tree
Showing 12 changed files with 121 additions and 71 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file.
6 changes: 5 additions & 1 deletion packages/java/.idea/sonarlint/issuestore/index.pb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion packages/java/.idea/sonarlint/securityhotspotstore/index.pb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

57 changes: 38 additions & 19 deletions packages/java/.idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 16 additions & 35 deletions packages/java/src/main/java/io/loganmatic/Main.java
Original file line number Diff line number Diff line change
@@ -1,51 +1,32 @@
package io.loganmatic;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Random;

import static java.lang.System.*;

public class Main {
// "I am using Math.pow because I couldn't develop a method for powers."
// Pi and EulerNumber start with Uppercase because of the ts/js code documentation.
public static final double Pi = 3.14159265358979323846;
private static final double Pi = 3.14159265358979323846;
private static final double EulerNumber = createEulerNumber();
private static final Random random = new Random();

public static void main(String[] args) {
// Call the method
}

/**
* The Euler number is a mathematical constant that is the base of the natural logarithm.
* The mathematical constant π (pi) represents the ratio of a circle's circumference to its diameter.
*/
public static double EulerNumber;
private static final Random random = new Random();
public static double getPi() {
return Pi;
}

public static void main(String[] args) {
EulerNumber = createEulerNumber();

out.println("EulerNumber: " + EulerNumber);
out.println("Pi: " + Pi);

// Testing the methods
out.println("Factorial of 5: " + factorial(5));
out.println("Square root of 16: " + squareRoot(16));
out.println("Cubic root of 27: " + cubicRoot(27));
out.println("Sine of 30: " + sine(30)); // Some problems with the trigonometric functions
out.println("Cosine of 60: " + cosine(60));
out.println("Tangent of 45: " + tangent(45));
out.println("Cotangent of 45: " + cotangent(45));
out.println("Secant of 60: " + secant(60));
out.println("Cosecant of 30: " + cosecant(30));
out.println("Absolute value of -10: " + absoluteValue(-10));

List<Integer> values = Arrays.asList(12, 18);
out.println("GCD of 12 and 18: " + gcd(values));
out.println("LCM of 12 and 18: " + lcm(values));

out.println("Random number between 1 and 10: " + randomNumberBetween(1, 10));

// Testing the equations
out.println("Linear equation result: " + linearEquation(2, 3).msg);
out.println("Quadratic equation result: " + quadraticEquation(1, -3, 2).msg);
out.println("Cubic equation result: " + cubicEquation(1, -6, 11, -6).msg);
/**
* The Euler number is a mathematical constant that is the base of the natural logarithm.
*/
public static double getEulerNumber() {
return EulerNumber;
}

private static double createEulerNumber() {
Expand Down
39 changes: 39 additions & 0 deletions packages/java/src/main/java/io/loganmatic/TestMethods.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package io.loganmatic;

import java.util.Arrays;
import java.util.List;

import static java.lang.System.*;

public class TestMethods {
public static void main(String[] args) {
out.println("Hello, World! This is a test of the methods in the Main class. \n");

// Call the method
out.println("EulerNumber: " + Main.getEulerNumber());
out.println("Pi: " + Main.getPi());

// Testing the methods
out.println("Factorial of 5: " + Main.factorial(5));
out.println("Square root of 16: " + Main.squareRoot(16));
out.println("Cubic root of 27: " + Main.cubicRoot(27));
out.println("Sine of 30: " + Main.sine(30)); // Some problems with the trigonometric functions
out.println("Cosine of 60: " + Main.cosine(60));
out.println("Tangent of 45: " + Main.tangent(45));
out.println("Cotangent of 45: " + Main.cotangent(45));
out.println("Secant of 60: " + Main.secant(60));
out.println("Cosecant of 30: " + Main.cosecant(30));
out.println("Absolute value of -10: " + Main.absoluteValue(-10));

List<Integer> values = Arrays.asList(12, 18);
out.println("GCD of 12 and 18: " + Main.gcd(values));
out.println("LCM of 12 and 18: " + Main.lcm(values));

out.println("Random number between 1 and 10: " + Main.randomNumberBetween(1, 10));

// Testing the equations
out.println("Linear equation result: " + Main.linearEquation(2, 3).msg);
out.println("Quadratic equation result: " + Main.quadraticEquation(1, -3, 2).msg);
out.println("Cubic equation result: " + Main.cubicEquation(1, -6, 11, -6).msg);
}
}
Binary file modified packages/java/target/classes/io/loganmatic/Main.class
Binary file not shown.
Binary file not shown.

0 comments on commit 2dd66ad

Please sign in to comment.