代做Homework 2: Citation Support System v.1代写Java编程

Homework 2: Citation Support System v.1

Due: Sunday, October 29, 11:59 pm

You will write the second version of the Citation Support System, building on your Homework 1 solution. Make sure you fix any problems noted in the grading of Homework 1. The user interface and the design have changed. You’ll be able to  reuse some code from Homework 1 – but note below where specifications have changed. For example, packages are now  used to partition the program code. The CitationList class had several methods that did keyboard input and screen output   in Homework 1; it does neither in this version – all input and output is done in main( ) and its helper methods.

Changes to Homework 1 Classes

Package CitationPackage

Class Citation: adds new member data, userID, so several methods change to account for it.

implements Comparable<Citation>: CHANGED: compareTo( ) by Citation number. This is for option 7, sort by number. int userID: NEW: a new data member to store the id of the person in charge of this citation. Create a getter and setter.

Citation constructor: CHANGED: add userID to the end of the list of parameters. toString( ), toCSV( ) – CHANGED: add userID to each.

Class CitationList: adds new functionality as shown in the revised menu, plus a few other changes.

readCitationFile(String filename) – reads a Citation CSV file. CHANGED: read a new field at the end, userID.

writeCitationFile(String filename) – writes a Citation CSV file. CHANGED: write a new field at the end, userID.

String displayCitationType(String typeOfOffense) – CHANGED: return one String containing any Citations with that typeOfOffense; return None found” if no Citations match this typeOfOffense.

String dispayCitation(int number) – CHANGED: return one String containing the Citation with that id number; return “None found” if no Citation matches this number.

String displayCitation(String lastName) – CHANGED: return one String containing any Citations whose Person object has that last name; return None found” if no Citations match this lastName.

newCitation( ) – DELETED; now in hw2Main

String delete(int number) – NEW: delete this Citation from listOfCitations. Return “Deleted” if it was deleted, “None found” if not. Menu option 6.

void sortByNumber( ) – NEW: sort the list by citation number using Citation.compareTo(). Menu option 7.

void sortByName() – NEW: sort the list by last name, first name using an anonymous inner class. Menu option 8. void sortByType( ) – NEW: sort the list by typeOfOffense using TypeSorter. Menu option 9.

String findByUser(int userID) – NEW: return one String containing any Citations associated with this userID, if any; return “None found” if none. Menu option 10.

Class TypeSorter: NEW

public int compare(Citation, Citation) – NEW: used for sorting by typeOfOffense.

Package src: New menu items, many changes to main( ) Class Menu:

String[] menuChoice: CHANGED: value check is between 0 and 10.

static int displayMenu( ): CHANGED; new menu options 6-10 added (described below).

Class hw2Main: Contains the main program and some data.

private static HashMap<String, String> configData – NEW: a map of <config item, value> pairs read by readConfigFile(); use the HashMap methods put(key, value) and value = get(key).

private static CitationList citationList MOVED: now outside of main; the list of Citation objects. private static UserList userList NEW: a list of the users

public static void newCitation( ) – CHANGED: in a new place; prompt the user for the information for one new Citation, including the userID, and add it to CitationList

private static HashMap<String, String> readConfigFile( ) – NEW: read the configuration file; hard-code the file name “configuration.csv”; return the hash map

main( ) – CHANGED:

1. Read the file “configuration.csv” at the start using readConfigFile() into configData. It contains {key, value} pairs with keys input file, output file, and user file; use the associated values for the file names.

2. Read the citation input file to create CitationList’s data; use the file name stored in configData.

3. Read the user input file to create UserList’s data.

4. For all display options, String data will be returned here and displayed (instead of being displayed in CitationList or elsewhere).

5. Write the citation output file; use the file name stored in configData.

New packages and classes

Package UserPackage:

For the User hierarchy, each class should have an overloaded constructor, getters, setters, and a toString( )

Class User: Models one user; abstract id: the user’s id number

String userName: the user’s screen name

Class Administrator: child of User

String department: where this person works

Class Officer: child of User

String rank: one of: Regular, Sargent, Captain, Inspector

Class CourtOfficial: child of User

String title: what this person’s role in the court system is.

Class UserFactory: contains the Factory Method

public static User createUser(int id, String userType, String name, String other) – factory method pattern to create one of the child classes of User using the userType in {Administrator Officer, CourtOfficial}; parameter other’s use

depends on the type of User.

Class UserList: models the list of users ArrayList<User> listOfUsers: user data

readUserFile(String filename): read the user data into listOfUsers toString( ): return one String with all the user data

ArrayList<User> getListOfUsers( ): return listOfUsers (for testing only)

New user interface menu options

6. Delete an existing Citation by number.

7. Sort Citations by number and display them (using toString)

8. Sort Citations by Person last name, first name and display them (using toString)

9. Sort Citations by type and display them (using toString)

10. Display Citations by User – display the userList, prompt the user for a user id, display all citations associated with that user id.

New data requirements

CHANGED: The Citation input file has the format:

number,typeOfOffense,description,date,first name,last name,address,phone number,user id as in:

1,Speeding,50mph,23-Aug-2023,Mary,Smith,123 Main Street,412-555-5555,2

The last value, userID, is a link to the User data.

NEW: The User input file has the format (“other” depends on the user type): user id number,user type,name,other

as in:

1,Administrator,Jones,Cyber

NEW: The configuration file has the format:

key,value as in:

input file,citations.csv

Deliverables: Zip up *only* your .java files; name it <your Andrew id>_hw2.zip; do *NOT* include test files. Upload it to Canvas.

Hints: Don't try to code the whole assignment at once. The ordering of the methods above may not be the order you want to code them in, either. If something is unclear, or if you’re just wondering about how to do something, ask!

Grading Rubric:

1. 80% on console output and test cases (these will be posted later).

2. 5% documentation: document each class and each method. Document your code only where needed – where the person grading it might have trouble understanding.

3. 5% Code quality: variable names, optimal loops, etc.

4. 5% Robustness: your code should not crash while processing reasonable data.

5. 5% Following submission instructions. NO LATE SUBMISSION, PLEASE!


热门主题

课程名

mktg2509 csci 2600 38170 lng302 csse3010 phas3226 77938 arch1162 engn4536/engn6536 acx5903 comp151101 phl245 cse12 comp9312 stat3016/6016 phas0038 comp2140 6qqmb312 xjco3011 rest0005 ematm0051 5qqmn219 lubs5062m eee8155 cege0100 eap033 artd1109 mat246 etc3430 ecmm462 mis102 inft6800 ddes9903 comp6521 comp9517 comp3331/9331 comp4337 comp6008 comp9414 bu.231.790.81 man00150m csb352h math1041 eengm4100 isys1002 08 6057cem mktg3504 mthm036 mtrx1701 mth3241 eeee3086 cmp-7038b cmp-7000a ints4010 econ2151 infs5710 fins5516 fin3309 fins5510 gsoe9340 math2007 math2036 soee5010 mark3088 infs3605 elec9714 comp2271 ma214 comp2211 infs3604 600426 sit254 acct3091 bbt405 msin0116 com107/com113 mark5826 sit120 comp9021 eco2101 eeen40700 cs253 ece3114 ecmm447 chns3000 math377 itd102 comp9444 comp(2041|9044) econ0060 econ7230 mgt001371 ecs-323 cs6250 mgdi60012 mdia2012 comm221001 comm5000 ma1008 engl642 econ241 com333 math367 mis201 nbs-7041x meek16104 econ2003 comm1190 mbas902 comp-1027 dpst1091 comp7315 eppd1033 m06 ee3025 msci231 bb113/bbs1063 fc709 comp3425 comp9417 econ42915 cb9101 math1102e chme0017 fc307 mkt60104 5522usst litr1-uc6201.200 ee1102 cosc2803 math39512 omp9727 int2067/int5051 bsb151 mgt253 fc021 babs2202 mis2002s phya21 18-213 cege0012 mdia1002 math38032 mech5125 07 cisc102 mgx3110 cs240 11175 fin3020s eco3420 ictten622 comp9727 cpt111 de114102d mgm320h5s bafi1019 math21112 efim20036 mn-3503 fins5568 110.807 bcpm000028 info6030 bma0092 bcpm0054 math20212 ce335 cs365 cenv6141 ftec5580 math2010 ec3450 comm1170 ecmt1010 csci-ua.0480-003 econ12-200 ib3960 ectb60h3f cs247—assignment tk3163 ics3u ib3j80 comp20008 comp9334 eppd1063 acct2343 cct109 isys1055/3412 math350-real math2014 eec180 stat141b econ2101 msinm014/msing014/msing014b fit2004 comp643 bu1002 cm2030
联系我们
EMail: 99515681@qq.com
QQ: 99515681
留学生作业帮-留学生的知心伴侣!
工作时间:08:00-21:00
python代写
微信客服:codinghelp
站长地图