something
This commit is contained in:
6
.classpath
Normal file
6
.classpath
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
17
.project
Normal file
17
.project
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>Praktikumid</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
11
.settings/org.eclipse.jdt.core.prefs
Normal file
11
.settings/org.eclipse.jdt.core.prefs
Normal file
@@ -0,0 +1,11 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
BIN
bin/lib/TextIO.class
Normal file
BIN
bin/lib/TextIO.class
Normal file
Binary file not shown.
BIN
bin/praktikum2/Grupeerija.class
Normal file
BIN
bin/praktikum2/Grupeerija.class
Normal file
Binary file not shown.
BIN
bin/praktikum2/Korrutaja.class
Normal file
BIN
bin/praktikum2/Korrutaja.class
Normal file
Binary file not shown.
BIN
bin/praktikum2/NimePikkus.class
Normal file
BIN
bin/praktikum2/NimePikkus.class
Normal file
Binary file not shown.
BIN
bin/praktikum2/Tere.class
Normal file
BIN
bin/praktikum2/Tere.class
Normal file
Binary file not shown.
BIN
bin/praktikum3/CumLaude.class
Normal file
BIN
bin/praktikum3/CumLaude.class
Normal file
Binary file not shown.
BIN
bin/praktikum3/ParooliSisestus.class
Normal file
BIN
bin/praktikum3/ParooliSisestus.class
Normal file
Binary file not shown.
BIN
bin/praktikum3/Tehisintellekt.class
Normal file
BIN
bin/praktikum3/Tehisintellekt.class
Normal file
Binary file not shown.
BIN
bin/praktikum4/numbrid0246.class
Normal file
BIN
bin/praktikum4/numbrid0246.class
Normal file
Binary file not shown.
BIN
bin/praktikum4/numbrid110.class
Normal file
BIN
bin/praktikum4/numbrid110.class
Normal file
Binary file not shown.
BIN
bin/praktikum4/numbrid302734.class
Normal file
BIN
bin/praktikum4/numbrid302734.class
Normal file
Binary file not shown.
BIN
bin/praktikum4/table1.class
Normal file
BIN
bin/praktikum4/table1.class
Normal file
Binary file not shown.
BIN
bin/praktikum4/table2.class
Normal file
BIN
bin/praktikum4/table2.class
Normal file
Binary file not shown.
1008
src/lib/TextIO.java
Normal file
1008
src/lib/TextIO.java
Normal file
File diff suppressed because it is too large
Load Diff
21
src/praktikum2/Grupeerija.java
Normal file
21
src/praktikum2/Grupeerija.java
Normal file
@@ -0,0 +1,21 @@
|
||||
package praktikum2;
|
||||
|
||||
public class Grupeerija {
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.printf("Sisesta inimeste arv: ");
|
||||
int inimeste_arv = lib.TextIO.getlnInt();
|
||||
|
||||
System.out.printf("Sisesta grupi suurus: ");
|
||||
int grupi_suurus = lib.TextIO.getlnInt();
|
||||
|
||||
int gruppide_arv = inimeste_arv / grupi_suurus;
|
||||
int inimeste_jääk = inimeste_arv % grupi_suurus;
|
||||
|
||||
System.out.printf("Kui %d inimest jagada gruppidesse kus igas grupi on %d inimest\n",
|
||||
inimeste_arv, grupi_suurus);
|
||||
System.out.printf("Siis oleks kokku %d gruppi ja üle jääks %d inimest",
|
||||
gruppide_arv, inimeste_jääk);
|
||||
}
|
||||
|
||||
}
|
||||
31
src/praktikum2/Korrutaja.java
Normal file
31
src/praktikum2/Korrutaja.java
Normal file
@@ -0,0 +1,31 @@
|
||||
package praktikum2;
|
||||
|
||||
public class Korrutaja {
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.printf("Sisesta esimene arv: ");
|
||||
int arv1 = lib.TextIO.getlnInt();
|
||||
|
||||
System.out.printf("Sisesta teine arv: ");
|
||||
int arv2 = lib.TextIO.getlnInt();
|
||||
|
||||
System.out.println("Arvude " + arv1 + " ja " + arv2 + " korrutis on " + arv1*arv2);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// █████ ▒██▒ ██▒ ▒██ ▒██▒
|
||||
// █████ ▓██▓ ██▓ ▓██ ▓██▓
|
||||
// ██ ████ ▒██ ██▒ ████
|
||||
// ██ ████ ▒██ ██▒ ████
|
||||
// ██ ▒█▓▓█▒ ██ ░██ ▒█▓▓█▒
|
||||
// ██ ▓█▒▒█▓ ██▒▒██ ▓█▒▒█▓
|
||||
// ██ ██ ██ ██▒▒██ ██ ██
|
||||
// ██ ██████ ▒████▒ ██████
|
||||
// ██ ░██████░ ░████░ ░██████░
|
||||
//█▒ ▒██ ▒██ ██▒ ████ ▒██ ██▒
|
||||
//███████▓ ███ ███ ████ ███ ███
|
||||
//░█████▒ ██▒ ▒██ ▓██▓ ██▒ ▒██
|
||||
//
|
||||
|
||||
|
||||
13
src/praktikum2/NimePikkus.java
Normal file
13
src/praktikum2/NimePikkus.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package praktikum2;
|
||||
|
||||
public class NimePikkus {
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Sisesta mingi nimi ja ma ütlen sulle selle pikkuse");
|
||||
System.out.printf("Sisesta nimi: ");
|
||||
String nimi = lib.TextIO.getlnString();
|
||||
int nimePikkus = nimi.length();
|
||||
System.out.println("Sisestatud nime pikkus on " + nimePikkus);
|
||||
}
|
||||
|
||||
}
|
||||
13
src/praktikum2/Tere.java
Normal file
13
src/praktikum2/Tere.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package praktikum2;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
public class Tere {
|
||||
|
||||
public static void main(String[] args) {
|
||||
int synniaasta = 1995;
|
||||
int vanus = Calendar.getInstance().get(Calendar.YEAR) - synniaasta;
|
||||
System.out.println ("Yo, ma olen Arti, hetkel " + vanus + " aastat vana");
|
||||
System.out.println ("Kinga numbrit peast ei mäleta hetkel....");
|
||||
}
|
||||
}
|
||||
38
src/praktikum3/CumLaude.java
Normal file
38
src/praktikum3/CumLaude.java
Normal file
@@ -0,0 +1,38 @@
|
||||
package praktikum3;
|
||||
|
||||
public class CumLaude {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
// Küsime kasutaja käest hindeid ujukomaarvudena
|
||||
System.out.printf("Sisesta keskmine hinne: ");
|
||||
double keskminehinne = lib.TextIO.getlnDouble();
|
||||
System.out.printf("Sisesta lõputöö hinne: ");
|
||||
double lõputööhinne = lib.TextIO.getlnDouble();
|
||||
|
||||
// Kasutajapoolt sisestatud numbrite reeglitele vastavuse kontroll
|
||||
if (keskminehinne > 5.0) {
|
||||
System.out.printf("Keskmine hinne ei tohi olla üle 5, teie seisestasite %.1f %n", keskminehinne);
|
||||
return; // välju main funktsioonist ja lõpeta programmi töö
|
||||
} else if (lõputööhinne >5.0) {
|
||||
System.out.printf("Lõputöö hinne ei tohi olla üle 5, teie seisestasite %.1f %n", lõputööhinne);
|
||||
return;
|
||||
} else if (keskminehinne < 0.0) {
|
||||
System.out.printf("Keskmine hinne ei tohi olla üle negatiivne, teie seisestasite %.1f %n", keskminehinne);
|
||||
return;
|
||||
} else if (lõputööhinne < 0.0) {
|
||||
System.out.printf("Lõputöö hinne ei tohi olla üle negatiivne, teie seisestasite %.1f %n", lõputööhinne);
|
||||
return;
|
||||
}
|
||||
|
||||
// Ülessanne ise
|
||||
if ((keskminehinne >= 4.5) && (lõputööhinne == 5.0)) {
|
||||
System.out.println("Palju õnne, saad Cum-Laude oma diplomile");
|
||||
} else {
|
||||
System.out.println("Sina kahjuks oma hinnetega Cum-Laude-t enda diplomile");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
11
src/praktikum3/ParooliSisestus.java
Normal file
11
src/praktikum3/ParooliSisestus.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package praktikum3;
|
||||
|
||||
public class ParooliSisestus {
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println("yo");
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
40
src/praktikum3/Tehisintellekt.java
Normal file
40
src/praktikum3/Tehisintellekt.java
Normal file
@@ -0,0 +1,40 @@
|
||||
package praktikum3;
|
||||
|
||||
public class Tehisintellekt {
|
||||
|
||||
public static void main(String[] args) {
|
||||
// Küsime kasutaja käest mõned vanused
|
||||
System.out.printf("Sisesta üks vanus: ");
|
||||
int esimenevanus = lib.TextIO.getlnInt();
|
||||
System.out.printf("Sisesta teine vanus: ");
|
||||
int teinevanus = lib.TextIO.getlnInt();
|
||||
|
||||
// Sisendi valideerimine
|
||||
if ((esimenevanus < 0) || (teinevanus < 0)) {
|
||||
System.out.println("Vanus ei tohi olla negatiivne");
|
||||
return;
|
||||
}
|
||||
|
||||
// Teeme järgnevad vanusevahe testid lihtsamaks eemaldades endest mitme erineva vanuse vahe testimise
|
||||
int esimenevanusevahe = esimenevanus-teinevanus;
|
||||
int teinevanusevahe = teinevanus-esimenevanus;
|
||||
int vanusevahe = 0; // vanusevahe mida me hakkame testima
|
||||
|
||||
if (esimenevanus < teinevanus) {
|
||||
vanusevahe = teinevanusevahe;
|
||||
} else {
|
||||
vanusevahe = esimenevanusevahe;
|
||||
}
|
||||
|
||||
|
||||
if ((vanusevahe > 5) && (vanusevahe < 10)) {
|
||||
System.out.println("Krõbe");
|
||||
} else if (vanusevahe >= 10) {
|
||||
System.out.println("Väga krõbe");
|
||||
} else {
|
||||
System.out.println("Sobib");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
12
src/praktikum4/numbrid0246.java
Normal file
12
src/praktikum4/numbrid0246.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package praktikum4;
|
||||
|
||||
public class numbrid0246 {
|
||||
|
||||
public static void main(String[] args) {
|
||||
for (int x = 0; x <= 10; x += 2) {
|
||||
System.out.printf("%d ", x);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
12
src/praktikum4/numbrid110.java
Normal file
12
src/praktikum4/numbrid110.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package praktikum4;
|
||||
|
||||
public class numbrid110 {
|
||||
|
||||
public static void main(String[] args) {
|
||||
for (int x = 1; x <= 10; x++) {
|
||||
System.out.printf("%d ", x);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
12
src/praktikum4/numbrid302734.java
Normal file
12
src/praktikum4/numbrid302734.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package praktikum4;
|
||||
|
||||
public class numbrid302734 {
|
||||
|
||||
public static void main(String[] args) {
|
||||
for (int x = 30; x > 0; x -=3) {
|
||||
System.out.printf("%d ", x);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
23
src/praktikum4/table1.java
Normal file
23
src/praktikum4/table1.java
Normal file
@@ -0,0 +1,23 @@
|
||||
package praktikum4;
|
||||
|
||||
public class table1 {
|
||||
|
||||
public static void main(String[] args) {
|
||||
final int x_size = 7; // table size in x direction
|
||||
final int y_size = 7; // table size in y direction
|
||||
|
||||
// Create the table
|
||||
for (int x = 0; x <= x_size; x++) {
|
||||
for (int y = 0; y <= y_size; y++) {
|
||||
if (x == y) {
|
||||
System.out.printf("1 ");
|
||||
} else {
|
||||
System.out.printf("0 ");
|
||||
}
|
||||
|
||||
}
|
||||
//we are at the end of the line, start a new one
|
||||
System.out.printf("%n");
|
||||
}
|
||||
}
|
||||
}
|
||||
30
src/praktikum4/table2.java
Normal file
30
src/praktikum4/table2.java
Normal file
@@ -0,0 +1,30 @@
|
||||
package praktikum4;
|
||||
|
||||
public class table2 {
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.printf("Tabeli X suurus: ");
|
||||
int x_size = lib.TextIO.getlnInt(); // table size in x direction
|
||||
System.out.printf("Tabeli Y suurus: ");
|
||||
int y_size = lib.TextIO.getlnInt(); // table size in y direction
|
||||
|
||||
// Create the table
|
||||
for (int x = 0; x <= x_size; x++) {
|
||||
System.out.printf("--");
|
||||
}
|
||||
System.out.printf("%n");
|
||||
for (int x = 0; x <= x_size; x++) {
|
||||
System.out.printf("| ");
|
||||
for (int y = 0; y <= y_size; y++) {
|
||||
if (x == y) {
|
||||
System.out.printf("1 ");
|
||||
} else {
|
||||
System.out.printf("0 ");
|
||||
}
|
||||
|
||||
}
|
||||
//we are at the end of the line, start a new one
|
||||
System.out.printf("%n");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user