Skip to content

Commit

Permalink
update all
Browse files Browse the repository at this point in the history
  • Loading branch information
senapk committed Dec 19, 2024
1 parent 9966e8c commit 0528a79
Show file tree
Hide file tree
Showing 187 changed files with 2,265 additions and 3,951 deletions.
9 changes: 1 addition & 8 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ Significado das tags nas questões:
### ArrayList II - Arrays de Null

- [ ] `@cinema :test`[Gerenciando reservas e cancelamentos de uma sala de cinema](base/cinema/Readme.md)
- [ ] `@topic :test`[Gerenciando assentos prioritários e normais](base/topic/Readme.md)
- [ ] `@junkfood :test`[Comprando comida cara e duvidosa](base/junkfood/Readme.md)

### ArrayList III - Composição e Enum
Expand All @@ -82,8 +81,6 @@ Significado das tags nas questões:

- [ ] `@agenda :test`[Gerencie os vários contatos de uma agenda](base/agenda/Readme.md)
- [ ] `@agiota :test`[Gerencie os empŕestimos do agiota](base/agiota/Readme.md)
- [ ] `@evento :test`[Bilheteria de um evento](base/evento/Readme.md)
- [ ] `@setor :test`[Eventos e setores em uma bilheteria](base/setor/Readme.md)

### Herança I

Expand All @@ -92,11 +89,6 @@ Significado das tags nas questões:
- [ ] `@cofre :test`[Seu porquinho cresceu](base/cofre/Readme.md)
- [ ] `@cadastro :test`[Crie as contas poupança e corrente](base/cadastro/Readme.md)

### Referências Cruzadas

- [ ] `@matricula :test`[Vínculos entre alunos e disciplina](base/matricula/Readme.md)
- [ ] `@twitter :test`[Twitter antes de ser bloqueado](base/twitter/Readme.md)

## Linguagem C++

### CPP - Configuração
Expand Down Expand Up @@ -139,6 +131,7 @@ Significado das tags nas questões:

### Em atualização

- [ ] `@twitter :test`[Twitter antes de ser bloqueado](base/twitter/Readme.md)
- [ ] [@salario](base/salario/Readme.md)
- [ ] [@comunicador](base/comunicador/Readme.md)
- [ ] [@paciente](base/paciente/Readme.md)
Expand Down
59 changes: 29 additions & 30 deletions base/agenda/.cache/draft/java/Shell.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,46 +4,45 @@
import java.util.stream.Collectors;
import java.util.Collections;

public class Shell {

public class Shell{

public static void main(String[] Args) {
Scanner scanner = new Scanner(System.in);
Agenda agenda = new Agenda();
static Scanner scanner = new Scanner(System.in);
public static void main(String[] _args) {

while (true) {
String line = scanner.nextLine();
write("$" + line);
System.out.println("$" + line);
String[] args = line.split(" ");

if (args[0].equals("end")) { break; }
else if (args[0].equals("add")) {
ArrayList<Fone> fones = new ArrayList<>();
for (int i = 2; i < args.length; i++) {
String[] fone = args[i].split(":");
fones.add(new Fone(fone[0], fone[1]));
}
agenda.addContato(args[1], fones);
if (args[0].equals("end")) {
break;
}
else if (args[0].equals("add")) {
// ArrayList<Fone> fones = new ArrayList<>();
// for (int i = 2; i < args.length; i++) {
// String[] fone = args[i].split(":");
// fones.add(new Fone(fone[0], fone[1]));
// }
}
else if (args[0].equals("show")) {
}
else if (args[0].equals("rm")) {
// var name = args[1];
}
else if (args[0].equals("favs")) {
}
else if (args[0].equals("search")) {
}

else if (args[0].equals("show")) { write(agenda.str()); }
else if (args[0].equals("rm")) { agenda.rmContact(args[1]); }
else if (args[0].equals("favs")) { write(agenda.getFavorited().stream().map(contact -> contact.str()).collect(Collectors.joining("\n"))); }
else if (args[0].equals("search")) { write(agenda.search(args[1]).stream().map(contact -> contact.str()).collect(Collectors.joining("\n"))); }

else if (args[0].equals("rmFone")) {
Contact contato = agenda.getContact(args[1]);
if (contato != null) contato.rmFone(number(args[2]));
// var name = args[1];
// var index = Integer.parseInt(args[2]);
}
else if (args[0].equals("tfav")) {
Contact contato = agenda.getContact(args[1]);
if (contato != null) contato.toogleFavorited();
else if (args[0].equals("tfav")) {
// var name = args[1];
}
else {
System.out.println("fail: invalid command");
}

else { write("fail: invalid command"); }
}
scanner.close();
}
public static int number(String number) { return Integer.parseInt(number); }
public static void write(String str) { System.out.println(str); }
}
43 changes: 16 additions & 27 deletions base/agenda/.cache/draft/ts/shell.ts
Original file line number Diff line number Diff line change
@@ -1,46 +1,35 @@
function input(): string { let X: any = input; X.L = X.L || require("fs").readFileSync(0).toString().split(/\r?\n/); return X.L.shift(); } // _TEST_ONLY_
// function input(): string { let X: any = input; X.P = X.P || require("readline-sync"); return X.P.question() } // _FREE_ONLY_
function write(text: any, endl="\n") { process.stdout.write("" + text + endl); }
const input = () => ""; // MODO_TESTE
export {};


function main(): void {
const agenda = new Agenda();
while (true) {
write("$", "");
let line = input();
write(line);
console.log("$" + line);

let args = line.split(" ");

if (args[0] === "end") {
break;
} else if (args[0] === "add") {//name id:fone id:fone ...
const fones: Fone[] = [];
for (let i = 2; i < args.length; i++) {
const parts: string[] = args[i].split(':');
fones.push(new Fone(parts[0], parts[1]));
}
agenda.addContact(args[1], fones);
// const fones: Fone[] = [];
// for (let i = 2; i < args.length; i++) {
// const parts: string[] = args[i].split(':');
// }
// agenda.addContact(args[1], fones);
} else if (args[0] === "show") {
write(agenda.toString());
} else if (args[0] === "rmFone") {//id index
const contato: Contact | null = agenda.getContact(args[1]);
if (contato !== null) {
contato.rmFone(Number(args[2]));
}
} else if (args[0] === "rm") {//id
agenda.rmContact(args[1]);
// const id = args[1];
// const index = parseInt(args[2]);
} else if (args[0] === "rm") {
const name = args[1];
} else if (args[0] === "tfav") {
const contato: Contact | null = agenda.getContact(args[1]);
if (contato !== null) {
contato.toogleFavorited();
}
// const id = args[1];
} else if (args[0] === "search") {//pattern
write(agenda.search(args[1]).join("\n"));
} else if (args[0] === "favs") {//pattern
write(agenda.getFavorited().join("\n"));
// const pattern = args[1];
} else if (args[0] === "favs") {
} else {
write("fail: comando invalido");
console.log("fail: comando invalido");
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions base/agenda/.cache/mapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
"ts": [
{
"name": "shell.ts",
"contents": "function input(): string { let X: any = input; X.L = X.L || require(\"fs\").readFileSync(0).toString().split(/\\r?\\n/); return X.L.shift(); } // _TEST_ONLY_\n// function input(): string { let X: any = input; X.P = X.P || require(\"readline-sync\"); return X.P.question() } // _FREE_ONLY_\nfunction write(text: any, endl=\"\\n\") { process.stdout.write(\"\" + text + endl); }\nexport {};\n\nfunction main(): void {\n const agenda = new Agenda();\n while (true) {\n write(\"$\", \"\");\n let line = input();\n write(line);\n \n let args = line.split(\" \");\n \n if (args[0] === \"end\") {\n break;\n } else if (args[0] === \"add\") {//name id:fone id:fone ...\n const fones: Fone[] = [];\n for (let i = 2; i < args.length; i++) {\n const parts: string[] = args[i].split(':');\n fones.push(new Fone(parts[0], parts[1]));\n }\n agenda.addContact(args[1], fones);\n } else if (args[0] === \"show\") {\n write(agenda.toString());\n } else if (args[0] === \"rmFone\") {//id index\n const contato: Contact | null = agenda.getContact(args[1]);\n if (contato !== null) {\n contato.rmFone(Number(args[2]));\n }\n } else if (args[0] === \"rm\") {//id\n agenda.rmContact(args[1]);\n } else if (args[0] === \"tfav\") {\n const contato: Contact | null = agenda.getContact(args[1]);\n if (contato !== null) {\n contato.toogleFavorited();\n }\n } else if (args[0] === \"search\") {//pattern\n write(agenda.search(args[1]).join(\"\\n\"));\n } else if (args[0] === \"favs\") {//pattern\n write(agenda.getFavorited().join(\"\\n\"));\n } else {\n write(\"fail: comando invalido\");\n }\n }\n}\n\n\nmain();\n",
"contents": "const input = () => \"\"; // MODO_TESTE\nexport {};\n\n\nfunction main(): void {\n while (true) {\n let line = input();\n console.log(\"$\" + line);\n \n let args = line.split(\" \");\n \n if (args[0] === \"end\") {\n break;\n } else if (args[0] === \"add\") {//name id:fone id:fone ...\n // const fones: Fone[] = [];\n // for (let i = 2; i < args.length; i++) {\n // const parts: string[] = args[i].split(':');\n // }\n // agenda.addContact(args[1], fones);\n } else if (args[0] === \"show\") {\n } else if (args[0] === \"rmFone\") {//id index\n // const id = args[1];\n // const index = parseInt(args[2]);\n } else if (args[0] === \"rm\") {\n const name = args[1];\n } else if (args[0] === \"tfav\") {\n // const id = args[1];\n } else if (args[0] === \"search\") {//pattern\n // const pattern = args[1];\n } else if (args[0] === \"favs\") {\n } else {\n console.log(\"fail: comando invalido\");\n }\n }\n}\n\n\nmain();\n",
"encoding": 0
}
],
"java": [
{
"name": "Shell.java",
"contents": "import java.util.ArrayList;\nimport java.util.List;\nimport java.util.Scanner;\nimport java.util.stream.Collectors;\nimport java.util.Collections;\n\n\npublic class Shell{\n\n public static void main(String[] Args) {\n Scanner scanner = new Scanner(System.in);\n Agenda agenda = new Agenda();\n\n while (true) {\n String line = scanner.nextLine();\n write(\"$\" + line);\n String[] args = line.split(\" \");\n \n if (args[0].equals(\"end\")) { break; }\n else if (args[0].equals(\"add\")) {\n ArrayList<Fone> fones = new ArrayList<>();\n for (int i = 2; i < args.length; i++) {\n String[] fone = args[i].split(\":\");\n fones.add(new Fone(fone[0], fone[1]));\n }\n agenda.addContato(args[1], fones);\n }\n \n else if (args[0].equals(\"show\")) { write(agenda.str()); }\n else if (args[0].equals(\"rm\")) { agenda.rmContact(args[1]); }\n else if (args[0].equals(\"favs\")) { write(agenda.getFavorited().stream().map(contact -> contact.str()).collect(Collectors.joining(\"\\n\"))); }\n else if (args[0].equals(\"search\")) { write(agenda.search(args[1]).stream().map(contact -> contact.str()).collect(Collectors.joining(\"\\n\"))); }\n \n else if (args[0].equals(\"rmFone\")) {\n Contact contato = agenda.getContact(args[1]);\n if (contato != null) contato.rmFone(number(args[2]));\n }\n else if (args[0].equals(\"tfav\")) {\n Contact contato = agenda.getContact(args[1]);\n if (contato != null) contato.toogleFavorited();\n }\n \n else { write(\"fail: invalid command\"); }\n }\n scanner.close();\n }\n public static int number(String number) { return Integer.parseInt(number); }\n public static void write(String str) { System.out.println(str); }\n}\n",
"contents": "import java.util.ArrayList;\nimport java.util.List;\nimport java.util.Scanner;\nimport java.util.stream.Collectors;\nimport java.util.Collections;\n\npublic class Shell {\n\n static Scanner scanner = new Scanner(System.in);\n public static void main(String[] _args) {\n\n while (true) {\n String line = scanner.nextLine();\n System.out.println(\"$\" + line);\n String[] args = line.split(\" \");\n \n if (args[0].equals(\"end\")) {\n break;\n }\n else if (args[0].equals(\"add\")) {\n // ArrayList<Fone> fones = new ArrayList<>();\n // for (int i = 2; i < args.length; i++) {\n // String[] fone = args[i].split(\":\");\n // fones.add(new Fone(fone[0], fone[1]));\n // }\n }\n else if (args[0].equals(\"show\")) {\n }\n else if (args[0].equals(\"rm\")) {\n // var name = args[1];\n }\n else if (args[0].equals(\"favs\")) {\n }\n else if (args[0].equals(\"search\")) {\n }\n else if (args[0].equals(\"rmFone\")) {\n // var name = args[1];\n // var index = Integer.parseInt(args[2]);\n }\n else if (args[0].equals(\"tfav\")) {\n // var name = args[1];\n }\n else {\n System.out.println(\"fail: invalid command\");\n }\n }\n }\n}\n",
"encoding": 0
}
],
Expand Down
1 change: 1 addition & 0 deletions base/agenda/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ Contact "1" *-- "0..*" Fone
Agenda "1" *-- "0..*" Contact

@enduml

```

<!-- load -->
Expand Down
Loading

0 comments on commit 0528a79

Please sign in to comment.