Skip to content

Commit 52d0134

Browse files
committed
Expressions - Operators & Operands
1 parent 2440023 commit 52d0134

29 files changed

+352
-0
lines changed

Expressions/.idea/.gitignore

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Expressions/.idea/codeStyles/Project.xml

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Expressions/.idea/codeStyles/codeStyleConfig.xml

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Expressions/.idea/compiler.xml

+13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Expressions/.idea/encodings.xml

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Expressions/.idea/jarRepositories.xml

+20
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Expressions/.idea/misc.xml

+14
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Expressions/.idea/vcs.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Expressions/operators.java

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
public class operators {
2+
public static void main(String[] args) {
3+
int result;
4+
int num1;
5+
int num2;
6+
int num3;
7+
8+
result = 0; // result has the value of 0
9+
10+
num1 = 22;
11+
num2 = 30;
12+
13+
num3 = num2; // both have the value 30
14+
15+
// Addition
16+
17+
result = 2 + 5; // result is now 7
18+
19+
result = num1 + num2; // result now equal 52
20+
21+
result = 1 + num1; // result now equals 23
22+
23+
result = 4 + num1 + num2 + num3;
24+
25+
result = 6; // now result has the value 2
26+
result += 3; // result is now equal to 9 (6 + 3)
27+
result += num1; // result now equal to 31 (9 + 22)
28+
29+
// Subtraction
30+
31+
result = 4 - 3; //result is now 1
32+
33+
result = num1 - num2; // result now equal -8
34+
35+
result = 50 - num1; // result now equals 28
36+
37+
result = 17 - num1 - num2 - num3; // result now equal -35
38+
39+
result = 4; // set result to 4
40+
result -= 8; // result is now equal to -4 (4 - 8)
41+
result -= num1; // result is now equal to -26 (-4 - 22)
42+
43+
44+
// Multiplication
45+
46+
result = 5 * 3; // result is now 15
47+
48+
result = num1 * num2; // result now equals 660
49+
50+
result = 3 * num1; // result now equals 66
51+
52+
result = 2 * num1 * num2 * num3; // result is now equal to 39600
53+
54+
result = 2; // set result to 2
55+
result *= 4; // result now equal to 8 (2 * 4)
56+
result *= num1; // result is now equal to 176
57+
58+
// Division and Modulus
59+
60+
result = 6 / 3; // result now equals 2
61+
62+
result = num1 / num2; // result now equals 0
63+
64+
result = num1 % num2; // result now equals 22
65+
66+
67+
result = 44 / num1; // result now equals 2
68+
69+
result = 245 / num1 / num2 / num3; // result now equals 0
70+
71+
result = 6; // set result to 20
72+
result /= 3; // result is now equal to 2 (6 / 3)
73+
result /= num1; // result is now equal to 0 (2 / 22)
74+
75+
}
76+
}

Expressions/pom.xml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>org.example</groupId>
8+
<artifactId>Expressions</artifactId>
9+
<version>1.0-SNAPSHOT</version>
10+
11+
<properties>
12+
<maven.compiler.source>17</maven.compiler.source>
13+
<maven.compiler.target>17</maven.compiler.target>
14+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15+
</properties>
16+
17+
</project>

Expressions/target/classes/.idea/.gitignore

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Expressions/target/classes/.idea/codeStyles/Project.xml

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Expressions/target/classes/.idea/codeStyles/codeStyleConfig.xml

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Expressions/target/classes/.idea/compiler.xml

+13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Expressions/target/classes/.idea/encodings.xml

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Expressions/target/classes/.idea/jarRepositories.xml

+20
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Expressions/target/classes/.idea/misc.xml

+14
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Expressions/target/classes/.idea/vcs.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
839 Bytes
Binary file not shown.

Expressions/target/classes/pom.xml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>org.example</groupId>
8+
<artifactId>Expressions</artifactId>
9+
<version>1.0-SNAPSHOT</version>
10+
11+
<properties>
12+
<maven.compiler.source>17</maven.compiler.source>
13+
<maven.compiler.target>17</maven.compiler.target>
14+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15+
</properties>
16+
17+
</project>

Expressions/target/classes/target/classes/.idea/.gitignore

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Expressions/target/classes/target/classes/.idea/codeStyles/Project.xml

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Expressions/target/classes/target/classes/.idea/codeStyles/codeStyleConfig.xml

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Expressions/target/classes/target/classes/.idea/compiler.xml

+13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Expressions/target/classes/target/classes/.idea/encodings.xml

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Expressions/target/classes/target/classes/.idea/jarRepositories.xml

+20
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Expressions/target/classes/target/classes/.idea/misc.xml

+14
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Expressions/target/classes/target/classes/.idea/vcs.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)