Introduction to Software Development
The Assignment
This Java exam will involve implementing a book cataloging system. You will be provided with the skeleton of the program and you will have to implement the methods and write the unit tests. The design of the program has been set up for you.
In this system, book files can be loaded, parsed, and managed in a book catalog. Books (represented by a Book class) are loaded and stored in a book catalog (represented by a BookCatalog class). A BookFileReader class will take care of initially loading the book files and doing some basic clean-up.
Copyright By PowCoder代写 加微信 powcoder
The Book class will take care of extracting the book title and author, counting the total number of words, and getting a count of each unique word (case-insensitive). The BookCatalog class will allow for adding books and looking up books based on their title or author.
Overall, the program will load three different book files (.txt) with BookFileReader, create three Book objects, and store them in BookCatalog. The required methods are already called in the main method in each section of the exam.
Exam Instructions
To help guide you through implementing the program, the exam has been split into 4 sections. For each section, there will be 2 tasks. The first task will be to complete the required methods in one java file and the second task will be to complete the unit testing for those methods in another java file. You will be provided with all of the necessary java files to complete the tasks in each section.
You are not required to complete the sections in a specific order. This is merely set up as a guide.
Exam Overview
For each section on the exam, the first task is to complete the required methods in the given class file. Then compile and run your code. Hints have been provided for some methods.
● Javadocs have already been provided
● You can create any number of helper methods, with appropriate names and javadocs
● Name your variables appropriately
● Add brief comments to all non-trivial lines of code
● For convenience, all of the required methods in the given class file are already called in its respective main method (follow along to learn the sequence of the methods). (Note, you are not required to run the main method in the given class file.)
The second task is to test your code by running (and passing) the provided test cases in the given test class file. (Do not modify any of the provided test cases!) Then write additional test cases for each test method as noted and make sure they pass as expected.
● The provided test cases are just SOME of the unit tests used for the autograded portion of this assignment. There will be more tests for the full autograded portion.
● You do not have to write unit tests for any helper methods you write.
The final structure of the project in the should look like the image on the left.
Codio Eclipse
Note, in Codio you can download the entire “submit” directory, which contains the starter code as a .zip file by going to Project -> Export as Zip. You can then import into a project within Eclipse. You may refer to the Importing a Java Program into Eclipse reading on Week 7 for more information. Please make sure that JUnit5 is in your build path. Don’t forget to also copy the .txt files and paste them into your Eclipse project. The .txt files should be in the project folder directly. They should not be inside the src folder. The structure of the project in Eclipse should look similar to the image on the right.
Introduction to Software Development
Introduction to Software Development
Exam Outline
● Section 1
○ Task 1: BookFileReader.java
■ Complete the parseFile method in the BookFileReader class. Compile and run your code.
● Note: You can use the “Run Your Program – BookFileReader” option in Codio to run the main method in this class.
○ Task 2: BookFileReaderTest.java
■ Test your code by running (and passing) the provided test cases in the
BookFileReaderTest class. Write additional test cases as noted in the testParseFile method and make sure they pass as expected. At the end, the testParseFile method should have a total of 3 distinct test cases.
● Note: You can use the “Run JUnit Tests” option in Codio to run all tests.
● Section 2
○ Task 1: Book.java
■ Complete the setTitleAndAuthor, getTitle, and getAuthor methods in the Book class. Compile and run your code.
● Note: You can use the “Run Your Program – Book” option in Codio to run the main method in this class.
○ Task 2: BookTest.java
■ Test your code by running (and passing) the provided test cases in the
BookTest class. Write additional test cases as noted in the testBook, testGetTitle, and testGetAuthor methods and make sure they pass as expected. At the end, each test method should have a total of 5 distinct test cases.
● Note: You can use the “Run JUnit Tests” option in Codio to run all tests.
● Section 3
○ Task 1: Book.java
■ Complete the countWords, getTotalWordCount, getUniqueWordCount, and getSpecificWordCount methods in the Book class. Compile and run your code.
● Note: You can use the “Run Your Program – Book” option in Codio to run the main method in this class.
○ Task 2: BookTest.java
■ Test your code by running (and passing) the provided test cases in the
BookTest class. Write additional test cases as noted in the testGetTotalWordCount, testGetUniqueWordCount, and testGetSpecificWordCount methods and make sure they pass as expected. At the end, testGetTotalWordCount should have a total of 7 distinct test cases, and testGetUniqueWordCount and testGetSpecificWordCount should have a total of 6 distinct test cases.
● Note: You can use the “Run JUnit Tests” option in Codio to run all tests.
● Section 4
○ Task 1: BookCatalog.java
■ Complete the addBook, getBookByTitle, and getBookByAuthor methods in the BookCatalog class. Compile and run your code.
● Note: You can use the “Run Your Program – BookCatalog” option in Codio to run the main method in this class.
○ Task 2: BookCatalogTest.java
■ Test your code by running (and passing) the provided test cases in the
Evaluation
Introduction to Software Development
BookCatalogTest class. Write additional test cases as noted in the testAddBook, testGetBookByTitle, and testGetBookByAuthor methods and make sure they pass as expected. At the end, each test method should have a total of 5 distinct test cases.
● Note: You can use the “Run JUnit Tests” option in Codio to run all tests.
1. Did you implement the individual methods correctly? – 30 points
a. Can you get the total count of words for each book?
b. Can you get each book by its title or its author?
c. Does your program successfully load and parse the .txt files and store the books
in the book catalog?
d. Does it correctly extract the book titles and authors?
2. Did you write good unit tests? – 20 points
a. Did you make sure each test method has the required number of test cases?
b. Does your program pass all of your own tests?
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com