debug ReportGenerator.java
This commit is contained in:
@@ -10,10 +10,10 @@ public class ReportGenerator {
|
|||||||
private final String ordersFilePath;
|
private final String ordersFilePath;
|
||||||
private final List<Product> productList;
|
private final List<Product> productList;
|
||||||
|
|
||||||
private double totalFinalCost;
|
private double totalFinalCost = 0;
|
||||||
private int totalQuantity;
|
private int totalQuantity = 0;
|
||||||
private double totalDiscountValue;
|
private double totalDiscountValue = 0;
|
||||||
private int totalInvalidLines;
|
private int totalInvalidLines = 0;
|
||||||
|
|
||||||
public ReportGenerator(String ordersFilePath, List<Product> productList) {
|
public ReportGenerator(String ordersFilePath, List<Product> productList) {
|
||||||
this.ordersFilePath = ordersFilePath;
|
this.ordersFilePath = ordersFilePath;
|
||||||
@@ -22,12 +22,10 @@ public class ReportGenerator {
|
|||||||
|
|
||||||
public void processFile()
|
public void processFile()
|
||||||
{
|
{
|
||||||
Scanner scanner = null;
|
|
||||||
|
|
||||||
try {
|
File file = new File(ordersFilePath);
|
||||||
|
|
||||||
File file = new File(ordersFilePath);
|
try (Scanner scanner = new Scanner(file)){
|
||||||
scanner = new Scanner(file);
|
|
||||||
|
|
||||||
while (scanner.hasNextLine()) {
|
while (scanner.hasNextLine()) {
|
||||||
|
|
||||||
@@ -76,10 +74,6 @@ public class ReportGenerator {
|
|||||||
System.out.println("File not found: " + ordersFilePath);
|
System.out.println("File not found: " + ordersFilePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scanner != null) {
|
|
||||||
scanner.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveReport()
|
public void saveReport()
|
||||||
|
|||||||
Reference in New Issue
Block a user