Skip to content
This repository was archived by the owner on Dec 8, 2023. It is now read-only.

Commit 6ccef69

Browse files
committed
Subiendo correcciones
1 parent 9f0bae2 commit 6ccef69

File tree

12 files changed

+22
-21
lines changed

12 files changed

+22
-21
lines changed

ejercicio2-balanza/src/main/java/ar/edu/unlp/info/oo1/ejercicio2_balanza/Balanza.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ public class Balanza {
55
private double precioTotal;
66
private double pesoTotal;
77

8-
public Balanza() { // consultar
8+
public Balanza() {
99
ponerEnCero();
1010
}
1111

@@ -18,13 +18,14 @@ public void ponerEnCero() {
1818
public void agregarProducto(Producto producto) {
1919
this.cantidadDeProductos++;
2020
this.pesoTotal = this.pesoTotal+ producto.getPeso();
21-
this.precioTotal = this.precioTotal + (producto.getPrecio()); // no correspondería realizarlo en el producto
22-
//ya que es la balanza quien obtiene este calculo,
23-
// un producto no puede calcular su precio total
21+
this.precioTotal = this.precioTotal + (producto.getPrecio());
2422
}
2523

2624
public Ticket emitirTicket() {
27-
Ticket ticket = new Ticket(this.getCantidadDeProductos(), this.getPesoTotal(), this.getPrecioTotal());
25+
int qProductos = this.getCantidadDeProductos();
26+
double pesoTotal = this.getPesoTotal();
27+
double precioTotal = this.getPrecioTotal(); // se agregan variables que obtienen los valores de los atributos para no enviar como parámetro la referencia de mi atributo. sería como "pasar por valor" los atributos
28+
Ticket ticket = new Ticket(qProductos, pesoTotal, precioTotal);
2829
return ticket;
2930
}
3031

ejercicio2-balanza/target/classes/META-INF/maven/ar.edu.unlp.info.oo1/ejercicio2-balanza/pom.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#Generated by Maven Integration for Eclipse
2-
#Sat Sep 02 20:02:24 ART 2023
2+
#Thu Sep 28 00:29:33 ART 2023
33
artifactId=ejercicio2-balanza
44
groupId=ar.edu.unlp.info.oo1
55
m2e.projectLocation=C\:\\Users\\User\\eclipse-workspace\\ejercicio2-balanza

ejercicio3bis-balanzaMejorada/src/main/java/ar/edu/unlp/info/oo1/ejercicio2_balanza/Balanza.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
public class Balanza {
77
private List<Producto> productos;
88

9-
public Balanza() { // consultar
9+
public Balanza() {
1010
ponerEnCero();
1111
}
1212

@@ -19,7 +19,8 @@ public void agregarProducto(Producto producto) {
1919
}
2020

2121
public Ticket emitirTicket() {
22-
Ticket ticket = new Ticket(this.getProductos());
22+
List<Producto> productosEnTicket = this.getProductos();
23+
Ticket ticket = new Ticket(productosEnTicket);
2324
return ticket;
2425
}
2526

ejercicio3bis-balanzaMejorada/src/main/java/ar/edu/unlp/info/oo1/ejercicio2_balanza/Ticket.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public LocalDate getFecha() {
2626
return fecha;
2727
}
2828

29-
// no los estoy calculando dos veces de la misma forma en dos distintas clases?
29+
// no los estoy calculando dos veces de la misma forma en dos distintas clases? -> es casualidad y está bien que sea así
3030
public int getCantidadDeProductos() {
3131
return this.productos.size();
3232
}
@@ -39,6 +39,4 @@ public double getPrecioTotal() {
3939
return this.productos.stream().mapToDouble(producto -> producto.getPrecio()).sum();
4040
}
4141

42-
43-
4442
}

ejercicio3bis-balanzaMejorada/target/classes/META-INF/maven/ar.edu.unlp.info.oo1/ejercicio2-balanza/pom.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#Generated by Maven Integration for Eclipse
2-
#Tue Sep 05 11:45:04 ART 2023
2+
#Thu Sep 28 20:40:08 ART 2023
33
artifactId=ejercicio2-balanza
44
groupId=ar.edu.unlp.info.oo1
55
m2e.projectLocation=C\:\\Users\\User\\eclipse-workspace\\ejercicio3bis-balanzaMejorada

ejercicio9-cuentaConGanchos/src/main/java/ar/edu/unlp/info/oo1/ejercicio9_cuentaConGanchos/CajaDeAhorro.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,22 @@ protected boolean puedeExtraer(double monto) {
1313
return false;
1414
}
1515

16+
@Override
1617
public void depositar(double monto) {
17-
super.depositar(monto);
18-
this.extraerSinControlar(this.impuesto(monto));
18+
super.depositar(monto-this.impuesto(monto));
1919
}
2020

21-
public boolean extraer(double monto) {
22-
if (super.extraer(monto)) {
23-
this.extraerSinControlar(this.impuesto(monto));
21+
@Override
22+
public boolean extraer(double monto) { // no lo puedo convertir a sentencia única porque sino no puedo devolver true o false en base a la operación, sino que me queda void
23+
if (super.extraer(monto+this.impuesto(monto))) {
2424
return true;
2525
}
2626
return false;
2727
}
2828

29-
public boolean transferirACuenta(double monto, Cuenta cuentaDestino) {
30-
if (super.transferirACuenta(monto, cuentaDestino)) {
31-
this.extraerSinControlar(this.impuesto(monto));
29+
@Override
30+
public boolean transferirACuenta(double monto, Cuenta cuentaDestino) { // idem
31+
if (super.transferirACuenta(monto+this.impuesto(monto), cuentaDestino)) {
3232
return true;
3333
}
3434
return false;

ejercicio9-cuentaConGanchos/src/test/java/ar/edu/unlp/info/oo1/ejercicio9_cuentaConGanchos/CajaDeAhorroTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import org.junit.jupiter.api.BeforeEach;
99
import org.junit.jupiter.api.Test;
1010

11+
// los tests se pueden hacer más robustos agregando más verificaciones en cada uno de los casos de las operaciones
1112

1213
public class CajaDeAhorroTest {
1314

ejercicio9-cuentaConGanchos/target/classes/META-INF/maven/ar.edu.unlp.info.oo1/ejercicio9-cuentaConGanchos/pom.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#Generated by Maven Integration for Eclipse
2-
#Sun Sep 24 09:45:17 ART 2023
2+
#Thu Sep 28 00:29:35 ART 2023
33
artifactId=ejercicio9-cuentaConGanchos
44
groupId=ar.edu.unlp.info.oo1
55
m2e.projectLocation=C\:\\Users\\User\\eclipse-workspace\\ejercicio9-cuentaConGanchos

0 commit comments

Comments
 (0)