-
Notifications
You must be signed in to change notification settings - Fork 0
/
BookMapper.java
36 lines (25 loc) · 1.11 KB
/
BookMapper.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import java.io.FileNotFoundException;
import java.util.List;
import java.util.Scanner;
/**
* Class with main method to run the book mapper app.
*/
public class BookMapper {
public static void main(String[] args) throws FileNotFoundException {
IBookLoader bookLoader = new BookLoader();
// load the books from the data file
List<IBook> bookList = bookLoader.loadBooks("books.csv");
// instantiate the backend
IBookMapperBackend backend = new BookMapperBackend();
// add all the books to the backend
for (IBook book : bookList) backend.addBook(book);
// instantiate the isbn validator
ISBNValidator isbnValidator = new ISBNValidator();
// instantiate the scanner for user input
Scanner userInputScanner = new Scanner(System.in);
// instantiate the front end and pass references to the scanner, backend, and isbn validator to it
IBookMapperFrontend frontend = new BookMapperFrontend(userInputScanner, backend, isbnValidator);
// start the input loop of the front end
frontend.runCommandLoop();
}
}