first commit

This commit is contained in:
2025-11-26 13:56:55 +01:00
commit c5f25901e1
188 changed files with 52799 additions and 0 deletions

5
Ugesedler/Ugeseddel-2 10-09-2025/.idea/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,5 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="21" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/Opgaver/Opgaver.iml" filepath="$PROJECT_DIR$/Opgaver/Opgaver.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/Programmeringsopgaver 10-09-2025.iml" filepath="$PROJECT_DIR$/.idea/Programmeringsopgaver 10-09-2025.iml" />
</modules>
</component>
</project>

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@@ -0,0 +1,126 @@
public class Opgaver {
public static void main(String[] args) {
System.out.println(Opgave1.opgave1(10.0,20.0,4.0,2.0));
/*Opgave2.opgave2();
Opgave3.opgave3a();
Opgave3.opgave3b();
Opgave3.opgave3c();
Opgave4.opgave4();
Opgave5.opgave5();*/
Opgave6.opgave6();
}
}
class Opgave1 {
public static double opgave1(double v0, double t, double a, double s0) {
System.out.println("\nOPGAVE 1:\n");
double s = s0 + v0*t+(0.5*a*(t*t));
return s;
}
}
class Opgave2 {
public static void opgave2() {
System.out.println("\nOPGAVE 2\n");
for (int i = 1; i <= 10; i++) {
System.out.print(" " + i*i);
}
System.out.println();
}
}
class Opgave3 {
public static void opgave3a() {
System.out.println("\nOPGAVE 3\n");
System.out.println("3a:");
for (int g = 1; g <= 3; g++) {
for (int i = 0; i < 10; i++) {
for (int j = 1; j <= 3; j++) {
System.out.print(i);
}
}
System.out.println();
}
}
public static void opgave3b() {
System.out.println("\n3b");
for (int g = 1; g <= 3; g++) {
for (int i = 9; i >= 0; i--) {
for (int j = 1; j <= 5; j++) {
System.out.print(i);
}
}
System.out.println();
}
}
public static void opgave3c() {
System.out.println("\n3c:");
for (int g = 1; g <= 3; g++) {
for (int i = 9; i >= 0; i--) {
for (int j = 1; j <= i; j++) {
System.out.print(i);
}
}
System.out.println();
}
}
}
class Opgave4 {
public static void opgave4() {
System.out.println("\nOPGAVE 4:\n");
int a = 1;
int b = 1;
System.out.print(a + ", " + b + ", ");
for (int i = 2; i<12; i++) {
int c = a + b;
System.out.print(c + ", ");
a = b;
b = c;
}
}
}
class Opgave5 {
public static void opgave5() {
int number = 1;
for (int i = 0; i <= 5; i++) {
printLines(6-number);
for (int j = 1; j <= number; j++) {
System.out.print(2*i-1);
}
printLines(6-number);
number++;
System.out.println();
}
}
public static void printLines(int amount) {
for (int j = amount; j >= 0; j--) {
System.out.print("-");
}
}
}
class Opgave6 {
public static void opgave6() {
System.out.println("\nOPGAVE 6\n");
printStairs(5);
}
public static void printStairs(int repeatAmount) {
for (int i = repeatAmount-1; i >= 0; i--) {
System.out.print("\n" + repeatString(i*5, " ") + " o ******" + repeatString((repeatAmount-i-1)*5, " ") + "*");
System.out.print("\n" + repeatString(i*5, " ") + " /|\\ *" + repeatString((repeatAmount-i)*5, " ") + "*");
System.out.print("\n" + repeatString(i*5, " ") + " / \\ *" + repeatString((repeatAmount-i)*5, " ") + "*");
}
System.out.println("\n" + repeatString((repeatAmount+1)*5+2, "*"));
}
public static String repeatString(int amount, String string) {
String returnString = "";
for (int i = 0; i < amount; i++) {
returnString = returnString + string;
}
return returnString;
}
}