Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Created structure that reads data from csv file, inside created proce… #946

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

Monsterhunter525
Copy link

…ss classes that can do supply, purchase & return, then creates a report and write it in output csv file

User added 4 commits October 4, 2023 23:49
…ss classes that can do supply, purchase & return, then creates a report and write it in output csv file
…ss classes that can do supply, purchase & return, then creates a report and write it in output csv file
…ss classes that can do supply, purchase & return, then creates a report and write it in output csv file
…ss classes that can do supply, purchase & return, then creates a report and write it in output csv file
Comment on lines 23 to 24
String inputFile = "src/main/resources/input.csv";
String outputFile = "src/main/resources/output.csv";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make these constants

Comment on lines 31 to 35
for (String line : inputLines) {
line = line.trim();
String[] transaction = line.split("\\s*,\\s*");
fruitService.processTransaction(transaction);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for (String line : inputLines) {
line = line.trim();
String[] transaction = line.split("\\s*,\\s*");
fruitService.processTransaction(transaction);
}
List<FruitTransaction> transactions = parseServise.parseTransactions(inputLines );
fruitService.processTransaction(transactions);

String[] transaction = line.split("\\s*,\\s*");
fruitService.processTransaction(transaction);
}
List<String> report = generateReport(storage);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
List<String> report = generateReport(storage);
List<String> report = reportService.generateReport();


public class Storage {
private static Storage instance;
private final Map<String, FruitTransaction> fruitInventory;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private final Map<String, FruitTransaction> fruitInventory;
private final Map<String, Integer> fruitInventory;

We are keeping Fruits on the storage - not FruitTransactions

Comment on lines 3 to 4
public class FruitTransaction {
private int quantity;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Comment on lines 3 to 4
public interface FruitService {
void processTransaction(String[] transaction);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public interface FruitService {
void processTransaction(String[] transaction);
public interface FruitService {
void processTransactions(List<FruitTransaction> transactions);

User added 6 commits October 8, 2023 01:06
…ss classes that can do supply, purchase & return, then creates a report and write it in output csv file
…ss classes that can do supply, purchase & return, then creates a report and write it in output csv file
…ss classes that can do supply, purchase & return, then creates a report and write it in output csv file
…ss classes that can do supply, purchase & return, then creates a report and write it in output csv file
…ss classes that can do supply, purchase & return, then creates a report and write it in output csv file
…ss classes that can do supply, purchase & return, then creates a report and write it in output csv file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants