what is bro doing

This commit is contained in:
ldlda
2024-11-13 12:36:48 +07:00 Unverified
parent 530354c2c9
commit f4b2089c6c
10 changed files with 212 additions and 0 deletions
+1
View File
@@ -24,3 +24,4 @@
hs_err_pid* hs_err_pid*
replay_pid* replay_pid*
bin
+8
View File
@@ -0,0 +1,8 @@
{
"java.project.sourcePaths": [
"src"
],
"java.project.outputPath": "bin",
"java.project.referencedLibraries": [],
"java.debug.settings.onBuildFailureProceed": true
}
+20
View File
@@ -0,0 +1,20 @@
# what the flying fuck is this
## Getting Started
Welcome to the VS Code Java world. Here is a guideline to help you get started to write Java code in Visual Studio Code.
## Folder Structure
The workspace contains two folders by default, where:
- `src`: the folder to maintain sources
- `lib`: the folder to maintain dependencies
Meanwhile, the compiled output files will be generated in the `bin` folder by default.
> If you want to customize the folder structure, open `.vscode/settings.json` and update the related settings there.
## Dependency Management
The `JAVA PROJECTS` view allows you to manage your dependencies. More details can be found [here](https://github.com/microsoft/vscode-java-dependency#manage-dependencies).
+5
View File
@@ -0,0 +1,5 @@
public class ClassName {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}
+61
View File
@@ -0,0 +1,61 @@
import java.util.Scanner;
public class FirstTimer {
/**
* Prompts user for input and attempts to parse it as an integer. If successful, calls mid() with the parsed value.
* If not, prints an error message and the exception.
* @param args unused
*/
public static void main(String[] args) {
String str = read_write();
try {
int c = Integer.parseInt(str);
mid(c);
} catch (NumberFormatException e) {
System.out.println(str + " isnt a number");
System.err.println(e);
}
}
/**
* Prints a prompt to the user, reads a line of input, strips it of whitespace, and returns it.
* @return the stripped input line
*/
static String read_write() {
System.out.print("echoer: ");
Scanner input = new Scanner(System.in);
String string = input.nextLine().strip();
input.close(); // thanks linter
System.out.println("that was: " + string);
return string;
}
/**
* Converts an integer to a binary string, handling negative numbers by taking the absolute value.
* Prints several debug messages to System.out.
* @param n the integer to convert
* @return the binary string representation of n
*/
static String mid(int n) {
if (n< 0){
System.out.println("no negative numbers dont work lets do " + String.valueOf(-n) + " instead:");
n = -n;
}
String ret = new String();
System.out.println("int in is " + Integer.toString(n));
do {
ret = String.valueOf(n % 2) + ret;
n /= 2;
} while (n > 0);
System.out.println("string out is " + ret);
System.out.println("it is correct: "
+ ret
+ " is "
+ Integer.parseInt(ret, 2)
+ " using parseInt which works in every language like wtf");
assert Integer.parseInt(ret, 2) == n;
return ret;
}
}
+12
View File
@@ -0,0 +1,12 @@
import lda.*;
public class Main {
public static void main(String[] args) {
System.out.println("Hello World!");
genericCar cR = new genericCar("car 1", "pig car", "a12bc");
cR.changeName("new name");
System.out.println(cR.inspect());
System.out.println(cR.toString());
FirstTimer.main(args);
}
}
+22
View File
@@ -0,0 +1,22 @@
package lda;
public class DialogueObject {
String caseName;
int id;
// array of dialogogs
String[] dialogues; // dialogugues are printed out one after another so using an array probably
// works
public DialogueObject(String caseName, int id, String[] dialogues) {
this.caseName = caseName;
this.id = id;
this.dialogues = dialogues;
}
// print how to support
public String toString() {
return "DialogueObject [caseName = " + caseName + ", id = " + id + ", dialogues = ["
+ String.join(", ", dialogues) + "]]";
// dialog is an array so cant print
}
}
+20
View File
@@ -0,0 +1,20 @@
package lda;
public class Main {
public static void main(String[] args) throws Exception {
System.out.println("i hate this so much");
testSwitch();
dialogeyTestMain.main(args);
}
public static void testSwitch() {
String caseName = "caseName";
String caseResult = switch (caseName) {
case "caseName" -> "Case name";
default -> "Default case";
};
System.out.println(caseResult);
}
}
// what should i do if i want to link another file from another class?
+40
View File
@@ -0,0 +1,40 @@
package lda;
import java.util.HashSet;
class dialogeyTestMain {
static void main(String[] args) {
DialogueObject[] dialogues = new DialogueObject[4];
dialogues[0] = new DialogueObject(
"dialogue 1",
0,
new String[] { "dialogue 1", "dialogue 2", "dialogue 3" });
dialogues[1] = new DialogueObject(
"dialogue 2",
1,
new String[] { "some", "dialogue" });
dialogues[2] = new DialogueObject(
"more Diabloghaes",
2,
new String[] { "i like", "dialogue", "and i dont like", "unecessary switch cases" });
dialogues[3] = new DialogueObject(
"dialogue 3",
3,
new String[] { "dialogue 1", "dialogue 2", "dialogue 3" });
HashSet<DialogueObject> theSameDialogObject = new HashSet<DialogueObject>();
for (int i = 0; i < dialogues.length; i++) {
theSameDialogObject.add(dialogues[i]);
}
// print out dialogues
for (int i = 0; i < dialogues.length; i++) {
System.out.println(dialogues[i]);
}
// print this hashset out:
System.out.println(theSameDialogObject);
}
}
+23
View File
@@ -0,0 +1,23 @@
package lda;
public class genericCar {
String carName;
String carModel;
String carPlate;
// static void main(String[] args) {
// System.out.println(args);
// }
public void changeName(String newName) {
carName = newName;
}
public genericCar (String name, String model, String plate) {
carName = name;
carModel = model;
carPlate = plate;
}
public String inspect(){
return carPlate; // police
}
public String toString() {
return "genericCar [carName = " + carName + ", carModel = " + carModel + ", carPlate = " + carPlate + "]";
}
}