Skip to content

Commit 1015c35

Browse files
authored
Merge pull request #2 from bigBrodyG/weekly-code-quality-fix-8332180035381052812
Weekly Code Quality Check & Fix
2 parents 3676379 + db6b8b7 commit 1015c35

14 files changed

Lines changed: 85 additions & 61 deletions

File tree

.github/scripts/generate-site.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ def main():
584584
{
585585
'name': 'mergeArray',
586586
'id': 'mergearray',
587-
'sources': ['Laboratorio/mergeArray/src/mergeArrays.java'],
587+
'sources': ['Laboratorio/mergeArray/src/MergeArrays.java'],
588588
'output': 'docs/mergearray-output.txt',
589589
'compile': 'docs/mergearray-compile.log',
590590
'description': 'Unione e ordinamento di array',
@@ -629,7 +629,7 @@ def main():
629629
{
630630
'name': 'vocalcount',
631631
'id': 'vocalcount',
632-
'sources': ['Laboratorio/vocalcount/src/voc_count.java'],
632+
'sources': ['Laboratorio/vocalcount/src/VocalCount.java'],
633633
'output': 'docs/vocalcount-output.txt',
634634
'compile': 'docs/vocalcount-compile.log',
635635
'description': 'Conteggio delle vocali in una stringa',

01_Verifica_teoria/src/Main.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
/**
66
* Classe main di test per la verifica delle corrette funzionalità
7-
* @param args
87
* @author giordii.dev
98
*/
109
public class Main {

ConvertitoreXML/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@
5151
<artifactId>maven-compiler-plugin</artifactId>
5252
<version>3.13.0</version>
5353
<configuration>
54-
<source>25</source>
55-
<target>25</target>
54+
<source>21</source>
55+
<target>21</target>
5656
</configuration>
5757
</plugin>
5858
<plugin>

Esercizi/Abbonamento/src/PortaCD.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ public void setActivity(String activity) {
4444
}
4545

4646
public LocalDate calcolaScadenza() {
47-
String scadenza;
47+
// TODO implementare la logica di calcolo della data di scadenza
48+
throw new UnsupportedOperationException("calcolaScadenza not yet implemented");
4849
}
4950
}
5051

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
void main() {
2-
Progetto progetto = new Progetto("Progetto Test", 2026);
1+
public class Main {
2+
public static void main(String[] args) {
3+
Progetto progetto = new Progetto("Progetto Test", 2026);
34

4-
progetto.aggiungiMembro(new Dirigente("D001", "Rossi", "Mario", 2010), 50);
5-
progetto.aggiungiMembro(new Funzionario("F001", "Bianchi", "Luigi", 2020), 100);
6-
progetto.aggiungiMembro(new Tecnico("T001", "Verdi", "Anna", 2018, Tecnico.Area.INFORMATICA_TELECOMUNICAZIONI, true), 150);
5+
progetto.aggiungiMembro(new Dirigente("D001", "Rossi", "Mario", 2010), 50);
6+
progetto.aggiungiMembro(new Funzionario("F001", "Bianchi", "Luigi", 2020), 100);
7+
progetto.aggiungiMembro(new Tecnico("T001", "Verdi", "Anna", 2018, Tecnico.Area.INFORMATICA_TELECOMUNICAZIONI, true), 150);
78

8-
progetto.stampaDettagliCosti();
9+
progetto.stampaDettagliCosti();
10+
}
911
}

Laboratorio/JavaFX/Impiciatto/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@
4747
<artifactId>maven-compiler-plugin</artifactId>
4848
<version>3.13.0</version>
4949
<configuration>
50-
<source>25</source>
51-
<target>25</target>
50+
<source>21</source>
51+
<target>21</target>
5252
</configuration>
5353
</plugin>
5454
<plugin>

Laboratorio/OggettoCD/src/PortaCD.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11

2+
import java.util.Objects;
3+
24
public class PortaCD {
35
private final Cd[] slots;
46
private int count;
@@ -91,4 +93,10 @@ private boolean equalsCd(Cd first, Cd second) {
9193
&& first.getNumBrani() == second.getNumBrani()
9294
&& Double.compare(first.getDurata(), second.getDurata()) == 0;
9395
}
96+
97+
private void validateIndex(int position) {
98+
if (position < 0 || position >= slots.length) {
99+
throw new IndexOutOfBoundsException("Invalid position: " + position);
100+
}
101+
}
94102
}

Laboratorio/Playlist/src/LibreriaMusicale.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public ArrayList<Brano> shuffleConSeed(String genere, int durataMax) {
130130
seed = seed * 31 + durataMax;
131131
seed = seed * 31 + pool.size();
132132

133-
ArrayList<Brano> mix = new ArrayLisdurataMaxt<>();
133+
ArrayList<Brano> mix = new ArrayList<>();
134134
int totDur = 0;
135135
int idx = (int) (Math.abs(seed) % pool.size());
136136

Laboratorio/SpeseManager/src/Main.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import java.time.LocalDate;
22
import java.util.List;
3-
import java.util.Scanner;
43

54
public class Main {
65

@@ -23,7 +22,7 @@ private static void stampaElenco(List<Spese> spese) {
2322
"%d) %s - %.2f (%s) | %s%n",
2423
i + 1,
2524
spesa.getCategory(),
26-
spesa.getMoneyyy(),
25+
spesa.getAmount(),
2726
spesa.getPayMethod(),
2827
spesa.getDate() == null ? "data non disponibile" : spesa.getDate()
2928
);
@@ -38,7 +37,7 @@ private static void stampaStatistiche(SpesaManager manager) {
3837
double min = Double.POSITIVE_INFINITY;
3938

4039
for (Spese spesa : spese) {
41-
double importo = spesa.getMoneyyy();
40+
double importo = spesa.getAmount();
4241
totale += importo;
4342
max = Math.max(max, importo);
4443
min = Math.min(min, importo);
@@ -67,7 +66,7 @@ private static double mediaPerCategoria(List<Spese> spese, String categoria) {
6766
int count = 0;
6867
for (Spese spesa : spese) {
6968
if (spesa.getCategory().equals(categoria)) {
70-
totale += spesa.getMoneyyy();
69+
totale += spesa.getAmount();
7170
count++;
7271
}
7372
}
@@ -78,7 +77,7 @@ private static double totalePerMetodo(List<Spese> spese, String metodo) {
7877
double totale = 0;
7978
for (Spese spesa : spese) {
8079
if (spesa.getPayMethod().equals(metodo)) {
81-
totale += spesa.getMoneyyy();
80+
totale += spesa.getAmount();
8281
}
8382
}
8483
return totale;

Laboratorio/SpeseManager/src/SpesaManager.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public ArrayList<Spese> getSpese() {
1818
public double spesaTotale() {
1919
double totale = 0;
2020
for (Spese spesa : spese) {
21-
totale += spesa.getMoneyyy();
21+
totale += spesa.getAmount();
2222
}
2323
return totale;
2424
}
@@ -31,10 +31,10 @@ public double spesaMax() {
3131
if (spese.isEmpty()) {
3232
return 0;
3333
}
34-
double max = spese.get(0).getMoneyyy();
34+
double max = spese.get(0).getAmount();
3535
for (Spese spesa : spese) {
36-
if (spesa.getMoneyyy() > max) {
37-
max = spesa.getMoneyyy();
36+
if (spesa.getAmount() > max) {
37+
max = spesa.getAmount();
3838
}
3939
}
4040
return max;
@@ -44,10 +44,10 @@ public double spesaMin() {
4444
if (spese.isEmpty()) {
4545
return 0;
4646
}
47-
double min = spese.get(0).getMoneyyy();
47+
double min = spese.get(0).getAmount();
4848
for (Spese spesa : spese) {
49-
if (spesa.getMoneyyy() < min) {
50-
min = spesa.getMoneyyy();
49+
if (spesa.getAmount() < min) {
50+
min = spesa.getAmount();
5151
}
5252
}
5353
return min;
@@ -80,7 +80,7 @@ private double spesaMediaPerCategoria(String categoria) {
8080
int count = 0;
8181
for (Spese spesa : spese) {
8282
if (spesa.getCategory().equals(categoria)) {
83-
totale += spesa.getMoneyyy();
83+
totale += spesa.getAmount();
8484
count++;
8585
}
8686
}
@@ -91,7 +91,7 @@ private double spesaTotPerPayMethod(String method) {
9191
double totale = 0;
9292
for (Spese spesa : spese) {
9393
if (spesa.getPayMethod().equals(method)) {
94-
totale += spesa.getMoneyyy();
94+
totale += spesa.getAmount();
9595
}
9696
}
9797
return totale;

0 commit comments

Comments
 (0)