Skip to content

Commit f38dd38

Browse files
committed
added the code for the first and second session and respective pdf
0 parents  commit f38dd38

File tree

102 files changed

+2978
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+2978
-0
lines changed

.classpath

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" output="target/classes" path="src/main/java">
4+
<attributes>
5+
<attribute name="optional" value="true"/>
6+
<attribute name="maven.pomderived" value="true"/>
7+
</attributes>
8+
</classpathentry>
9+
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
10+
<attributes>
11+
<attribute name="optional" value="true"/>
12+
<attribute name="maven.pomderived" value="true"/>
13+
<attribute name="test" value="true"/>
14+
</attributes>
15+
</classpathentry>
16+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
17+
<attributes>
18+
<attribute name="maven.pomderived" value="true"/>
19+
</attributes>
20+
</classpathentry>
21+
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
22+
<attributes>
23+
<attribute name="maven.pomderived" value="true"/>
24+
</attributes>
25+
</classpathentry>
26+
<classpathentry kind="output" path="target/classes"/>
27+
</classpath>

.project

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>javacourse-2021</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>org.eclipse.m2e.core.maven2Builder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
</buildSpec>
19+
<natures>
20+
<nature>org.eclipse.jdt.core.javanature</nature>
21+
<nature>org.eclipse.m2e.core.maven2Nature</nature>
22+
</natures>
23+
</projectDescription>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
eclipse.preferences.version=1
2+
encoding//src/main/java=UTF-8
3+
encoding//src/test/java=UTF-8
4+
encoding/<project>=UTF-8

.settings/org.eclipse.jdt.core.prefs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
3+
org.eclipse.jdt.core.compiler.compliance=11
4+
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
5+
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
6+
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
7+
org.eclipse.jdt.core.compiler.release=enabled
8+
org.eclipse.jdt.core.compiler.source=11

.settings/org.eclipse.m2e.core.prefs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
activeProfiles=
2+
eclipse.preferences.version=1
3+
resolveWorkspaceProjects=true
4+
version=1

Code for session 1.pdf

71.6 KB
Binary file not shown.

Code for session 2.pdf

92.7 KB
Binary file not shown.

finmath-checkstyle.xml

Lines changed: 186 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
<?xml version="1.0"?>
2+
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN" "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
3+
4+
<!--
5+
finmath lib checkstyle configuration.
6+
Adapted from the sun coding conventions.
7+
Currently many checks are disabled as we are slowing adding our own conventions.
8+
For updates check the finmath lib project home page.
9+
-->
10+
11+
<module name="Checker">
12+
<!-- If you set the basedir property below, then all reported file names
13+
will be relative to the specified directory. See http://checkstyle.sourceforge.net/5.x/config.html#Checker
14+
<property name="basedir" value="${basedir}"/> -->
15+
16+
<property name="fileExtensions" value="java, properties, xml" />
17+
18+
<!-- Checks that a package-info.java file exists for each package. -->
19+
<!-- See http://checkstyle.sf.net/config_javadoc.html#JavadocPackage -->
20+
<module name="JavadocPackage" />
21+
22+
<!-- Checks whether files end with a new line. -->
23+
<!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
24+
<!--
25+
<module name="NewlineAtEndOfFile">
26+
<property name="lineSeparator" value="lf" />
27+
</module>
28+
-->
29+
30+
<!-- Checks that property files contain the same keys. -->
31+
<!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
32+
<!-- <module name="Translation" /> -->
33+
34+
<!-- Checks for Size Violations. -->
35+
<!-- See http://checkstyle.sf.net/config_sizes.html -->
36+
<!-- <module name="FileLength" /> -->
37+
38+
<!-- Checks for whitespace -->
39+
<!-- See http://checkstyle.sf.net/config_whitespace.html -->
40+
<!-- <module name="FileTabCharacter" /> -->
41+
42+
<!-- Miscellaneous other checks. -->
43+
<!-- See http://checkstyle.sf.net/config_misc.html -->
44+
<module name="RegexpSingleline">
45+
<!-- Lines should not have trailing whitespace, only exception is a single
46+
empty JavaDoc line -->
47+
<property name="format" value="^(?!\s+\* $).*?\s+$" />
48+
<property name="minimum" value="0" />
49+
<property name="maximum" value="0" />
50+
<property name="message" value="Line has trailing spaces." />
51+
</module>
52+
53+
<!-- <module name="LineLength"> <property name="max" value="400" /> </module> -->
54+
55+
<!-- Checks for Headers -->
56+
<!-- See http://checkstyle.sf.net/config_header.html -->
57+
<!-- <module name="Header"> -->
58+
<!-- <property name="headerFile" value="${checkstyle.header.file}"/> -->
59+
<!-- <property name="fileExtensions" value="java"/> -->
60+
<!-- </module> -->
61+
62+
<module name="TreeWalker">
63+
64+
<!-- Checks for Javadoc comments. -->
65+
<!-- See http://checkstyle.sf.net/config_javadoc.html -->
66+
<!-- <module name="JavadocMethod" /> -->
67+
<module name="JavadocType">
68+
<property name="scope" value="public" />
69+
<property name="allowUnknownTags" value="true" />
70+
<!-- Add ENUM_DEF, ANNOTATION_DEF in future version. -->
71+
<property name="tokens" value="INTERFACE_DEF, CLASS_DEF" />
72+
</module>
73+
<!-- <module name="JavadocVariable" /> -->
74+
<!-- <module name="JavadocStyle" /> -->
75+
76+
<!-- Checks for Naming Conventions. -->
77+
<!-- See http://checkstyle.sf.net/config_naming.html -->
78+
<!-- <module name="ConstantName" /> -->
79+
<!-- <module name="LocalFinalVariableName" /> -->
80+
81+
<!-- THE FOLLOWING WILL BECOME ACTIVE SOON. -->
82+
<!-- <module name="LocalVariableName"> <property name="allowOneCharVarInForLoop"
83+
value="true"/> </module> -->
84+
85+
<module name="MemberName" />
86+
87+
<!-- THE FOLLOWING WILL BECOME ACTIVE SOON. -->
88+
<!-- <module name="MethodName" /> -->
89+
90+
<module name="PackageName" />
91+
<module name="ParameterName" />
92+
<module name="StaticVariableName" />
93+
94+
<!-- THE FOLLOWING WILL BECOME ACTIVE without underscores SOON. -->
95+
<module name="TypeName">
96+
<property name="format" value="^[A-Z][a-zA-Z0-9_]*$" />
97+
</module>
98+
99+
<!-- Checks for imports -->
100+
<!-- See http://checkstyle.sf.net/config_import.html -->
101+
<module name="AvoidStarImport" />
102+
<module name="IllegalImport" /> <!-- defaults to sun.* packages -->
103+
<module name="RedundantImport" />
104+
<module name="UnusedImports">
105+
<property name="processJavadoc" value="true" />
106+
</module>
107+
108+
<!-- Checks for Size Violations. -->
109+
<!-- See http://checkstyle.sf.net/config_sizes.html -->
110+
<module name="MethodLength">
111+
<property name="tokens" value="METHOD_DEF" />
112+
<property name="max" value="350" />
113+
</module>
114+
<module name="ParameterNumber">
115+
<property name="max" value="15" />
116+
</module>
117+
118+
<!-- Checks for whitespace -->
119+
<!-- See http://checkstyle.sf.net/config_whitespace.html -->
120+
<!-- <module name="EmptyForIteratorPad" /> <module name="GenericWhitespace"
121+
/> <module name="MethodParamPad" /> <module name="NoWhitespaceAfter" /> <module
122+
name="NoWhitespaceBefore" /> <module name="OperatorWrap" /> <module name="ParenPad"
123+
/> <module name="TypecastParenPad" /> <module name="WhitespaceAfter" /> <module
124+
name="WhitespaceAround" /> -->
125+
126+
<!-- Modifier Checks -->
127+
<!-- See http://checkstyle.sf.net/config_modifiers.html -->
128+
<module name="ModifierOrder" />
129+
<module name="RedundantModifier" />
130+
131+
<!-- Checks for blocks. You know, those {}'s -->
132+
<!-- See http://checkstyle.sf.net/config_blocks.html -->
133+
<module name="AvoidNestedBlocks">
134+
<property name="allowInSwitchCase" value="true" />
135+
</module>
136+
<module name="EmptyBlock" />
137+
<!-- <module name="LeftCurly"/> -->
138+
139+
<module name="NeedBraces">
140+
<property name="allowSingleLineStatement" value="true" />
141+
</module>
142+
<!-- <module name="RightCurly" /> -->
143+
144+
<!-- Checks for common coding problems -->
145+
<!-- See http://checkstyle.sf.net/config_coding.html -->
146+
<!-- <module name="AvoidInlineConditionals" /> -->
147+
<module name="EmptyStatement" />
148+
<module name="EqualsHashCode" />
149+
<!-- <module name="HiddenField"> <property name="ignoreConstructorParameter"
150+
value="true" /> <property name="ignoreSetter" value="true" /> <property name="setterCanReturnItsClass"
151+
value="true" /> </module> -->
152+
<module name="IllegalInstantiation" />
153+
<module name="InnerAssignment" />
154+
<!-- <module name="MagicNumber" /> -->
155+
<module name="MissingSwitchDefault" />
156+
<!-- <module name="SimplifyBooleanExpression" /> -->
157+
<module name="SimplifyBooleanReturn" />
158+
159+
<!-- Checks for class design -->
160+
<!-- See http://checkstyle.sf.net/config_design.html -->
161+
<!-- <module name="DesignForExtension" /> <module name="FinalClass" />
162+
<module name="HideUtilityClassConstructor" /> <module name="InterfaceIsType"
163+
/> -->
164+
165+
<module name="VisibilityModifier">
166+
<property name="allowPublicImmutableFields" value="true" />
167+
</module>
168+
169+
<!-- Miscellaneous other checks. -->
170+
<!-- See http://checkstyle.sf.net/config_misc.html -->
171+
<module name="ArrayTypeStyle" />
172+
<!--
173+
<module name="FinalParameters">
174+
<property name="ignorePrimitiveTypes" value="true" />
175+
</module>
176+
-->
177+
<module name="TodoComment" />
178+
<module name="UpperEll" />
179+
180+
<module name="RegexpSinglelineJava">
181+
<property name="format" value="^\t*(?! \*) " />
182+
<property name="message"
183+
value="Indent must use tab characters" />
184+
</module>
185+
</module>
186+
</module>

pom.xml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
<groupId>com.andreamazzon</groupId>
6+
<artifactId>javacourse-2021</artifactId>
7+
<version>0.0.1-SNAPSHOT</version>
8+
9+
<properties>
10+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
11+
<junit.version>4.12</junit.version>
12+
<!-- maven plugins -->
13+
<compiler-plugin.version>3.8.1</compiler-plugin.version>
14+
<checkstyle-plugin.version>3.1.1</checkstyle-plugin.version>
15+
</properties>
16+
17+
<dependencies>
18+
<dependency>
19+
<groupId>junit</groupId>
20+
<artifactId>junit</artifactId>
21+
<version>${junit.version}</version>
22+
<scope>test</scope>
23+
</dependency>
24+
</dependencies>
25+
26+
<build>
27+
<plugins>
28+
<plugin>
29+
<artifactId>maven-compiler-plugin</artifactId>
30+
<version>${compiler-plugin.version}</version>
31+
<configuration>
32+
<release>11</release>
33+
</configuration>
34+
</plugin>
35+
<plugin>
36+
<groupId>org.apache.maven.plugins</groupId>
37+
<artifactId>maven-checkstyle-plugin</artifactId>
38+
<version>${checkstyle-plugin.version}</version>
39+
<configuration>
40+
<configLocation>finmath-checkstyle.xml</configLocation>
41+
</configuration>
42+
</plugin>
43+
</plugins>
44+
</build>
45+
</project>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.andreamazzon.session1.divisible;
2+
3+
/**
4+
* This class checks if a number is divisible by another number: this is a very simple example of if/else statement
5+
*
6+
* @author Andrea Mazzon
7+
*/
8+
public class Divisible {
9+
10+
public static void main(String[] args) {
11+
12+
int dividend = 13;
13+
int divisor = 4;
14+
15+
boolean statement = (dividend % divisor == 0);//the parenthesis are not necessary, but in this way is more readable
16+
//note: the operator % gives the reminder of the ratio of two numbers
17+
if (statement) {
18+
//or directly:
19+
//if (dividend % divisor == 0) //more common. Writing it separately I wanted to stress the fact that it's s boolean
20+
System.out.println(dividend + " is divisible by " + divisor);
21+
}
22+
else {
23+
System.out.println(dividend + " is not divisible by " + divisor);
24+
}
25+
}
26+
}

0 commit comments

Comments
 (0)