Skip to content

Commit b4da471

Browse files
author
jhonochoa
committed
Se añade implementacion en base al test que se creo anteriormente
1 parent c8f4fa1 commit b4da471

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

javatest/src/main/java/com/testing/javatest/discounts/PriceCalculator.java

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,24 @@
11
package com.testing.javatest.discounts;
22

3+
import java.util.ArrayList;
4+
import java.util.List;
5+
36
public class PriceCalculator {
47

5-
8+
private List<Double> prices = new ArrayList<>();
9+
610
public double getTotal() {
7-
return 0;
11+
12+
double result = 0;
13+
for (Double price : prices) {
14+
result += price;
15+
}
16+
17+
return result;
818
}
919

1020
public void addPrice(double price) {
11-
// TODO Auto-generated method stub
12-
21+
prices.add(price);
22+
1323
}
1424
}
15-

0 commit comments

Comments
 (0)