BAEL-3506
This commit is contained in:
parent
ad8ab66522
commit
662f19103c
|
@ -0,0 +1,8 @@
|
|||
## Java Math
|
||||
|
||||
This module contains articles about math in Java.
|
||||
|
||||
### Relevant articles:
|
||||
|
||||
- [Basic Calculator in Java](https://www.baeldung.com/basic-calculator-in-java)
|
||||
- More articles: [[<-- prev]](/../java-math)
|
|
@ -0,0 +1,105 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>java-math-2</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>java-math-2</name>
|
||||
|
||||
<parent>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>parent-modules</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-math3</artifactId>
|
||||
<version>${commons-math3.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.ejml</groupId>
|
||||
<artifactId>ejml-all</artifactId>
|
||||
<version>${ejml.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.nd4j</groupId>
|
||||
<artifactId>nd4j-native</artifactId>
|
||||
<version>${nd4j.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.la4j</groupId>
|
||||
<artifactId>la4j</artifactId>
|
||||
<version>${la4j.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>colt</groupId>
|
||||
<artifactId>colt</artifactId>
|
||||
<version>${colt.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>${guava.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
<version>${commons-codec.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>${lombok.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.assertj</groupId>
|
||||
<artifactId>assertj-core</artifactId>
|
||||
<version>${org.assertj.core.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.dpaukov</groupId>
|
||||
<artifactId>combinatoricslib3</artifactId>
|
||||
<version>${combinatoricslib3.version}</version>
|
||||
</dependency>
|
||||
<!-- Benchmarking -->
|
||||
<dependency>
|
||||
<groupId>org.openjdk.jmh</groupId>
|
||||
<artifactId>jmh-core</artifactId>
|
||||
<version>${jmh.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.openjdk.jmh</groupId>
|
||||
<artifactId>jmh-generator-annprocess</artifactId>
|
||||
<version>${jmh.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>${exec-maven-plugin.version}</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
|
||||
<properties>
|
||||
<commons-math3.version>3.6.1</commons-math3.version>
|
||||
<org.assertj.core.version>3.9.0</org.assertj.core.version>
|
||||
<commons-codec.version>1.11</commons-codec.version>
|
||||
<guava.version>27.0.1-jre</guava.version>
|
||||
<combinatoricslib3.version>3.3.0</combinatoricslib3.version>
|
||||
<ejml.version>0.38</ejml.version>
|
||||
<nd4j.version>1.0.0-beta4</nd4j.version>
|
||||
<colt.version>1.2.0</colt.version>
|
||||
<la4j.version>0.6.0</la4j.version>
|
||||
<jmh.version>1.19</jmh.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.maths;
|
||||
package com.baeldung.maths.calculator.basic;
|
||||
|
||||
import java.util.InputMismatchException;
|
||||
import java.util.Scanner;
|
||||
|
@ -7,7 +7,6 @@ public class BasicCalculatorIfElse {
|
|||
|
||||
public static void main(String[] args) {
|
||||
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
System.out.println("---------------------------------- \n" +
|
||||
"Welcome to Basic Calculator \n" +
|
||||
"----------------------------------");
|
||||
|
@ -16,6 +15,8 @@ public class BasicCalculatorIfElse {
|
|||
"2. Subtraction (-) \n" +
|
||||
"3. Multiplication (* OR x) \n" +
|
||||
"4. Division (/) \n");
|
||||
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
try {
|
||||
System.out.println("Enter an operator: (+ OR - OR * OR /) ");
|
||||
char operation = scanner.next().charAt(0);
|
||||
|
@ -47,6 +48,8 @@ public class BasicCalculatorIfElse {
|
|||
}
|
||||
} catch (InputMismatchException exc) {
|
||||
System.err.println(exc.getMessage());
|
||||
} finally {
|
||||
scanner.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.maths;
|
||||
package com.baeldung.maths.calculator.basic;
|
||||
|
||||
import java.util.InputMismatchException;
|
||||
import java.util.Scanner;
|
||||
|
@ -6,7 +6,6 @@ import java.util.Scanner;
|
|||
public class BasicCalculatorSwitchCase {
|
||||
public static void main(String[] args) {
|
||||
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
System.out.println("---------------------------------- \n"
|
||||
+ "Welcome to Basic Calculator \n"
|
||||
+ "----------------------------------");
|
||||
|
@ -15,6 +14,8 @@ public class BasicCalculatorSwitchCase {
|
|||
"2. Subtraction (-) \n" +
|
||||
"3. Multiplication (* OR x) \n" +
|
||||
"4. Division (/) \n");
|
||||
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
try {
|
||||
System.out.println("Enter an operator: (+ OR - OR * OR /) ");
|
||||
char operation = scanner.next().charAt(0);
|
||||
|
@ -55,8 +56,9 @@ public class BasicCalculatorSwitchCase {
|
|||
}
|
||||
} catch (InputMismatchException exc) {
|
||||
System.err.println(exc.getMessage());
|
||||
} finally {
|
||||
scanner.close();
|
||||
}
|
||||
scanner.close();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
|
||||
</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<root level="INFO">
|
||||
<appender-ref ref="STDOUT" />
|
||||
</root>
|
||||
</configuration>
|
Loading…
Reference in New Issue