Skip to content

Commit 5ce8993

Browse files
committed
Some new notes from Java and Javascript
1 parent 4ec1522 commit 5ce8993

13 files changed

+8661
-14
lines changed

Java/Functions.java

+14
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,20 @@ else if (array[mid] == target){
4747
return 0;
4848
}
4949

50+
static int[] ManipulatedArray(int[]array){
51+
int[]array2 = new int[array.length + 1];
52+
for (int i =0;i<array.length;i++){
53+
if (array[i] >= array.length/2){
54+
array2[i] = array[i];
55+
array2[array2.length - 1] = 9000;
56+
}
57+
}
58+
for (int i : array2){
59+
System.out.println(String.format("x(%d)",i));
60+
}
61+
return array2;
62+
}
63+
5064
public static void main(String args[]){
5165
Gael(79);
5266
System.out.println(RecursiveSum(79));

Java/GaelSystem.txt

-4
This file was deleted.

Java/Input.java

+7-1
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,19 @@ public static void main (String args[]){
5656
Haha.Pride(); an example of separate classes in separate files with inheritance
5757
*/
5858

59+
System.out.println("\n\n\n\n");
5960
int[]array = {12,312,12,414,1222};
6061
Functions.ArraySum(array);
6162

6263
GaelChild Publicity = new GaelChild();
6364
Publicity.OnlyPublic();
6465
GaelChild.CanBeStatic();
6566

66-
//Gael Iris = new Gael("Iris");
67+
int[] TestArray = Functions.ManipulatedArray(array);
68+
for (int i : TestArray){
69+
System.out.println(i);
70+
}
71+
72+
Gael Tinie = new Gael("Tinie");
6773
}
6874
}

Java/ObjectsSystem/Gael.java

+58-8
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
1+
//This java file simulates a software engineer / developer's life
12
package ObjectsSystem;
23
import java.util.*;
4+
import java.util.jar.Attributes.Name;
35
import java.io.*;
46

57
public class Gael{
6-
String Specialization = "Programming";
7-
String Fear = "Insects";
8+
private String Specialization = "Programming";
9+
private String Fear = "Insects";
810
String Interests = "Programming, Video Games, Music, Pewdiepie";
911
short Age = 19;
1012
char Gender = 'M';
11-
int Money;
12-
String Agenda = "";
13-
String Condition = "Neutral";
14-
String Name;
13+
private int Money;
14+
private String Agenda = "";
15+
private String Condition = "Neutral";
16+
private String Name;
17+
private int NoteCount = 0;
18+
1519

1620
public Gael(String name){
1721
Name = name;
@@ -55,7 +59,7 @@ else if (Money >= 1000){
5559

5660
public void Mission(){
5761
System.out.println("");
58-
System.out.println("So much options in life! What to do?:\na. Work\nb. Study\nc. Watch Youtube/Netflix\nd. Gamble\n e. Rest");
62+
System.out.println("So much options in life! What to do?:\na. Work\nb. Study\nc. Watch Youtube/Netflix\nd. Gamble\n e. Rest\nf. Note-Taking");
5963
Scanner line = new Scanner(System.in);
6064
String choice = line.next();
6165
if (choice.equals("a")){
@@ -79,6 +83,9 @@ else if (choice.equals("d")){
7983
else if (choice.equals("e")){
8084
Rest();
8185
}
86+
else if (choice.equals("f")){
87+
InfiniteInput();
88+
}
8289

8390
}
8491

@@ -213,12 +220,16 @@ public void Rest(){
213220
System.out.println(String.format("Money: %d \nCondition: %s\n",Money,Condition));
214221
System.out.println("Check the directory for the stats of your performance");
215222
try{
216-
FileWriter rawstats = new FileWriter("../PersonalProjects/Java/GaelSystem.txt");
223+
FileWriter rawstats = new FileWriter("../PersonalProjects/Java/ObjectsSystem/GaelSystem.txt");
217224
BufferedWriter Stats = new BufferedWriter(rawstats);
218225
Stats.write("| GAEL SYSTEM STATS PERFORMANCE |");
219226
Stats.newLine();
220227
Stats.write(String.format("| NAME | --> %s",Name));
221228
Stats.newLine();
229+
Stats.write(String.format("| CONDITION | --> %s",Condition));
230+
Stats.newLine();
231+
Stats.write(String.format("| AGE | --> %s",Age));
232+
Stats.newLine();
222233
Stats.write(String.format("| CURRENT CONDITION | --> %s",Condition));
223234
Stats.newLine();
224235
Stats.write(String.format("| MONEY | --> %d",Money));
@@ -231,4 +242,43 @@ public void Rest(){
231242
}
232243

233244
}
245+
246+
public void InfiniteInput(){
247+
ArrayList<Object> NoteArray = new ArrayList<>();
248+
System.out.println("You will start writing your own Notes as of now! Prepare the lines");
249+
System.out.println(String.format("%s's Notes",Name));
250+
Scanner LineNotes = new Scanner(System.in);
251+
try{
252+
FileWriter raw = new FileWriter(String.format("../PersonalProjects/Java/ObjectsSystem/%sNotes%d.txt",Name,NoteCount));
253+
BufferedWriter notes = new BufferedWriter(raw);
254+
while(true){
255+
String newnotes = LineNotes.nextLine();
256+
if (newnotes.equals("DONE")){
257+
System.out.println("You have finally finished Note-taking!");
258+
for (int i=0;i<NoteArray.size();i++){
259+
notes.write(String.format("Entry %d: ",i+1));
260+
notes.write(NoteArray.get(i).toString());
261+
notes.newLine();
262+
}
263+
notes.flush();
264+
notes.close();
265+
raw.close();
266+
NoteCount++;
267+
for (Object i : NoteArray){
268+
System.out.println(i);
269+
}
270+
break;
271+
}
272+
else{
273+
NoteArray.add(newnotes);
274+
}
275+
}
276+
Mission();
277+
}
278+
catch (IOException e){
279+
System.out.println("Error");
280+
e.printStackTrace();
281+
}
282+
}
283+
234284
}

Java/ObjectsSystem/GaelSystem.txt

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
| GAEL SYSTEM STATS PERFORMANCE |
2+
| NAME | --> Tinie
3+
| CONDITION | --> Sad
4+
| AGE | --> 19
5+
| CURRENT CONDITION | --> Sad
6+
| MONEY | --> 259

Java/ObjectsSystem/TinieNotes0.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Entry 1: I enjoy my weekend with my sister and my nephew :3
2+
Entry 2: I love cooking for them.
3+
Entry 3: I want to sleep after because It's so fucking tiring taking care of them.

Java/ObjectsSystem/TinieNotes1.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Entry 1: Uhmm my nephew was the only one who watched and finished Chucky.
2+
Entry 2: And the movie sucks
3+
Entry 3: I need to take a bath later tonight because I smell hideous and filthy because I haven't taken a shower today.
5.29 MB
Binary file not shown.

0 commit comments

Comments
 (0)