Compare commits

..

9 commits
task/2 ... nya

Author SHA1 Message Date
6fa68b07b8
complete: 9 2024-06-13 22:49:29 +02:00
5fe83d7ee8
complete: 8 2024-06-03 17:01:42 +02:00
19dcae87c3
complete: 7 2024-05-23 15:25:10 +02:00
a52e81d6c8
complete: 6 2024-05-11 23:30:42 +02:00
897ef9bf4b
complete: 5 2024-04-30 22:37:13 +02:00
6784d02b95
complete: 4 2024-04-19 19:16:03 +02:00
befd8c1e8b
complete: 1 2024-03-28 20:33:29 +01:00
9429a39b3c
complete: 2 2024-03-28 20:23:53 +01:00
6ba738d773
complete: 3 2024-03-28 19:24:00 +01:00
2 changed files with 14 additions and 67 deletions

View file

@ -1,65 +0,0 @@
import java.util.Arrays;
/*
* TASK 2
* archived at https://git.femboy.science/femsci/ppj/src/branch/task/2
* by femsci
*/
public class Mrrrp {
public static void main(String[] args) {
if (args.length != 3) {
System.err.printf("Invalid argument count: %d. Expected 3.\n", args.length);
System.exit(2);
}
sortContrained_ꭥmꭥ(args);
fancyCollectionsAndStreamsΘѡΘ(args);
}
public static void sortContrained_ꭥmꭥ(String[] args) {
int a, b, c;
try {
a = Integer.parseInt(args[0]);
b = Integer.parseInt(args[1]);
c = Integer.parseInt(args[2]);
} catch (Exception e) {
System.err.println("Invalid arguments.");
System.exit(1);
return;
}
int buf;
// eepy sort (fixed 3:)
if (a > b) {
buf = a;
a = b;
b = buf;
}
if (a > c) {
buf = a;
a = c;
c = buf;
}
if (b > c) {
buf = b;
b = c;
c = buf;
}
System.out.printf("%d %d %d\n", a, b, c);
}
// cute one-liner
public static void fancyCollectionsAndStreamsΘѡΘ(String[] args) {
try {
Arrays.asList(args).stream().map(Integer::parseInt).sorted().forEach(n -> System.out.printf("%d ", n));
System.err.println();
} catch (Exception e) {
System.err.println("Invalid arguments.");
System.exit(1);
}
}
}

View file

@ -1,5 +1,17 @@
# PPJ
This branch contains the solution for the **2nd task**.
This repository exists to archive PJATK tasks for the PPJ curriculum.
[Go back to main](/femsci/ppj/src/branch/nya)
Each task can be found under its **corresponding branch**: `task/n`.
### Completed tasks:
- [Task 1](/femsci/ppj/src/branch/task/1)
- [Task 2](/femsci/ppj/src/branch/task/2)
- [Task 3](/femsci/ppj/src/branch/task/3)
- [Task 4](/femsci/ppj/src/branch/task/4)
- [Task 5](/femsci/ppj/src/branch/task/5)
- [Task 6](/femsci/ppj/src/branch/task/6)
- [Task 7](/femsci/ppj/src/branch/task/7)
- [Task 8](/femsci/ppj/src/branch/task/8)
- [Task 9](/femsci/ppj/src/branch/task/9)