Starting git repo for working on files

This commit is contained in:
sulzlep
2024-07-13 12:44:25 +02:00
commit d45a2994e8
20 changed files with 185 additions and 0 deletions
Binary file not shown.
+23
View File
@@ -0,0 +1,23 @@
public class CMYKtoRGB
{
public static void main(String [] args){
double cyan = Double.parseDouble(args[0]);
double magenta = Double.parseDouble(args[1]);
double yellow = Double.parseDouble(args[2]);
double black = Double.parseDouble(args[3]);
double white = 1 - black;
double red = 255 * white * (1 - cyan);
double green = 255 * white * (1 - magenta);
double blue = 255 * white * (1 - yellow);
int decimal_red = (int) Math.round(red);
int decimal_green = (int) Math.round(green);
int decimal_blue = (int) Math.round(blue);
System.out.println("red = " + decimal_red);
System.out.println("green = " + decimal_green);
System.out.println("blue = " + decimal_blue);
}
}
Binary file not shown.
+23
View File
@@ -0,0 +1,23 @@
public class GreatCircle
{
public static void main(String [] args){
double x1 = Math.toRadians(Double.parseDouble(args[0]));
double y1 = Math.toRadians(Double.parseDouble(args[1]));
double x2 = Math.toRadians(Double.parseDouble(args[2]));
double y2 = Math.toRadians(Double.parseDouble(args[3]));
double t1 = (x2 - x1) / 2.0;
double t2 = (y2 - y1) / 2.0;
double q1 = Math.pow(Math.sin(t1), 2);
double q2 = Math.pow(Math.sin(t2), 2);
double as = q1 + (Math.cos(x1) * Math.cos(x2) * q2);
double sq = Math.sqrt(as);
double distance = 2 * 6371.0 * Math.asin(sq);
System.out.println(distance + " kilometers");
}
}
Binary file not shown.
+10
View File
@@ -0,0 +1,10 @@
public class HelloGoodbye
{
public static void main(String [] args){
String name1 = args[0];
String name2 = args[1];
System.out.println("Hello " + name2 + " and " + name1 + ".");
System.out.println("Goodbye " + name2 + " and " + name1 + ".");
}
}
Binary file not shown.
+6
View File
@@ -0,0 +1,6 @@
public class HelloWorld {
public static void main(String [] args)
{
System.out.println("Hello, World");
}
}
Binary file not shown.
+20
View File
@@ -0,0 +1,20 @@
public class RightTriangle
{
public static void main(String [] args){
int a = Integer.parseInt(args[0]);
int b = Integer.parseInt(args[1]);
int c = Integer.parseInt(args[2]);
boolean isPositive;
boolean isSquare;
boolean result;
isPositive = (a >= 0) && (b >= 0) && (c >= 0);
int square_a = a * a;
int square_b = b * b;
int square_c = c * c;
isSquare = ( square_a + square_b) == square_c || (square_b + square_c) == square_a || (square_a + square_c) == square_b;
result = isPositive && isSquare;
System.out.println(result);
}
}
BIN
View File
Binary file not shown.