95712-Fall 2023 HW1
1
Problem Statement
The Federal Trade Commission (FTC) is a government agency that is responsible for "protecting consumers and
competition by preventing anticompetitive, deceptive, and unfair business practices through law enforcement,
advocacy, and education without unduly burdening legitimate business activity."1 It conducts investigative cases
against companies that engage in unlawful practices that harm consumers in any way. These cases are logged in
FTC site and are available for public review.
You need to build a tool that can help analyze these FTC cases. To start with, Table 1 shows a sample of cases
from the dataset. The data is in a tab-separated file named FTC-cases-TSV.txt. Important things to note in data:
1. Each case has a date, a title, a case type, and a case number. However, case type and case number may be
missing for some cases.
2. The date is in yyyy-mm-dd format
3. Case type is given at the end of the Title within parentheses. The cu
ent data has Federal and
Administrative as two case types
4. Case number is a string of some characters.
Table 1: FTC Case Data
Case date Title (case type) Case number
XXXXXXXXXXKuuhuub, Inc., et al., U.S. v. (Recolor Oy) (Federal XXXXXXXXXX
XXXXXXXXXXFlo Health, Inc. (Administrative XXXXXXXXXX
XXXXXXXXXXEveralbum, Inc., In the Matter of (Administrative XXXXXXXXXX
XXXXXXXXXXSupport King, LLC (SpyFone.com), In the Matter of (Administrative XXXXXXXXXX
XXXXXXXXXXVivint Smart Home, Inc. (Federal XXXXXXXXXX
XXXXXXXXXXTapplock, Inc., In the Matter of (Administrative XXXXXXXXXX
XXXXXXXXXXFacebook, Inc., In the Matter of (Administrative XXXXXXXXXX; 182
3109; C-4365
The first version of our tool - which we will call as CyberCop 1.0 - will be based on Character User Interface (CUI)
and needs to do the following:
1. Search for cases reported against a company
2. Search for cases reported in a year
3. Search for a case number
4. Print case type summary
5. Print year-wise summary
Please refer to sample scenarios at the end of this document.
1 https:
www.ftc.gov/about-ftc
https:
www.ftc.gov
https:
www.ftc.gov/about-ftc
https:
www.ftc.gov/about-ftc
95712-Fall 2023 HW1
2
Solution Design
The solution design has four classes.
CyberCop
• main() method is the app's entry point
• showMenu() is to get user inputs
• print…() methods are to print the outputs
as shown in the sample scenarios at the
end of this document.
CCModel:
• loadData()reads data from
CyberCop.DATAFILE and stores it in fileData
• loadCases() reads data from fileData,
parses each row to create Case objects and
stores them in cases a
ay
SearchEngine:
• searchTitle(): takes searchString and cases
a
ay. Returns an a
ay of Cases whose title
contain the searchString. The search is
case-insensitive
• searchYear(): takes year as a String and
cases a
ay. Returns an a
ay of Cases that
were data falls in the year
• searchCaseNumner: takes Figure 1: Class diagram caseNumber and cases a
ay and return an a
ay of Cases
that contain the caseNumber in their caseNumber property.
Case:
• The constructor takes all four parameters as Strings and initializes its instance variables
• The getYear() method is optional and it returns the year of the caseDate.
More specifics are given in code files as comments.
Design Constraint: Use of Collection classes (A
ayLists, LinkedLists, Sets, Maps, etc.) is not allowed in HW1
Instructions:
95712-Fall 2023 HW1
3
• Download the files from Canvas and store them in a project and a
package as shown in Fig. 2.
• Complete your code.
• It is expected that you follow the design provided and do not add new
classes, methods, or member variables. Making any design changes
may impact test-cases and may also need rework for you in
HW2/HW3.
• Write your name and Andrew id as comments at the top in all your
Java files.
• You will test your program in two ways: Console output (refer sample
outputs at the end of this document) and TestCyberCop.java. These
two tests will get you 80% of the points. Other criteria applied to
evaluate your program are:
1. Documentation (5%): Your code should be well-commented, i.e., neither Figure 2: Folder structure
too many comments, nor too few. Yes, this requires a little bit of your
judgment! Name your variables in a self-explanatory way. Write your name and Andrew id at the top in
the comments in each class. Indent your code properly. (In Eclipse, press Ctrl-A to select all your code
and then Ctrl-I to indent)
2. Code quality (5%): coding conventions, no unused variables/li
aries, etc. Use your judgment to assess
these criteria.
3. Code robustness (5%): Your program should not throw any e
ors while processing. You can safely
assume that the user will not enter any ga
age input.
4. Submission instructions (5%): Zip all your java files except test-file into AndrewId-hw1.zip. Do not
submit any other folders, class files, test file, text files, and rest of your kitchen sink! Only last
submission will be graded. Wrong files, inco
ect package name, etc. may take away some points.
NO LATE SUBMISSIONS PLEASE! If you are unable to submit on time, you lose all the points. Please avoid last
minute submission as Canvas may decide to quit on you! Learn to trust technology only to the extent you
should! Do not take that risk! No late submission will be accepted.
95712-Fall 2023 HW1
4
Sample outputs
Scenario 1: Menu option 1 - A company has multiple cases
Scenario 2: Menu option 1 - A company with no reported case
95712-Fall 2023 HW1
5
Scenario 3: Menu option 2 - Several cases reported in a yea
95712-Fall 2023 HW1
6
Scenario 4: Menu option 2 - No cases in a yea
Scenario 5: Menu option 3 - Case number found
95712-Fall 2023 HW1
7
Scenario 6: Menu option 3 - Case number not found
Scenario 7: Menu option 4
95712-Fall 2023 HW1
8
Scenario 8: Menu option 5
Problem Statement
CyberCop
Sample outputs
95712-Fall 2023 HW1
1
Problem Statement
The Federal Trade Commission (FTC) is a government agency that is responsible for "protecting consumers and
competition by preventing anticompetitive, deceptive, and unfair business practices through law enforcement,
advocacy, and education without unduly burdening legitimate business activity."1 It conducts investigative cases
against companies that engage in unlawful practices that harm consumers in any way. These cases are logged in
FTC site and are available for public review.
You need to build a tool that can help analyze these FTC cases. To start with, Table 1 shows a sample of cases
from the dataset. The data is in a tab-separated file named FTC-cases-TSV.txt. Important things to note in data:
1. Each case has a date, a title, a case type, and a case number. However, case type and case number may be
missing for some cases.
2. The date is in yyyy-mm-dd format
3. Case type is given at the end of the Title within parentheses. The cu
ent data has Federal and
Administrative as two case types
4. Case number is a string of some characters.
Table 1: FTC Case Data
Case date Title (case type) Case number
XXXXXXXXXXKuuhuub, Inc., et al., U.S. v. (Recolor Oy) (Federal XXXXXXXXXX
XXXXXXXXXXFlo Health, Inc. (Administrative XXXXXXXXXX
XXXXXXXXXXEveralbum, Inc., In the Matter of (Administrative XXXXXXXXXX
XXXXXXXXXXSupport King, LLC (SpyFone.com), In the Matter of (Administrative XXXXXXXXXX
XXXXXXXXXXVivint Smart Home, Inc. (Federal XXXXXXXXXX
XXXXXXXXXXTapplock, Inc., In the Matter of (Administrative XXXXXXXXXX
XXXXXXXXXXFacebook, Inc., In the Matter of (Administrative XXXXXXXXXX; 182
3109; C-4365
The first version of our tool - which we will call as CyberCop 1.0 - will be based on Character User Interface (CUI)
and needs to do the following:
1. Search for cases reported against a company
2. Search for cases reported in a year
3. Search for a case number
4. Print case type summary
5. Print year-wise summary
Please refer to sample scenarios at the end of this document.
1 https:
www.ftc.gov/about-ftc
https:
www.ftc.gov
https:
www.ftc.gov/about-ftc
https:
www.ftc.gov/about-ftc
95712-Fall 2023 HW1
2
Solution Design
The solution design has four classes.
CyberCop
• main() method is the app's entry point
• showMenu() is to get user inputs
• print…() methods are to print the outputs
as shown in the sample scenarios at the
end of this document.
CCModel:
• loadData()reads data from
CyberCop.DATAFILE and stores it in fileData
• loadCases() reads data from fileData,
parses each row to create Case objects and
stores them in cases a
ay
SearchEngine:
• searchTitle(): takes searchString and cases
a
ay. Returns an a
ay of Cases whose title
contain the searchString. The search is
case-insensitive
• searchYear(): takes year as a String and
cases a
ay. Returns an a
ay of Cases that
were data falls in the year
• searchCaseNumner: takes Figure 1: Class diagram caseNumber and cases a
ay and return an a
ay of Cases
that contain the caseNumber in their caseNumber property.
Case:
• The constructor takes all four parameters as Strings and initializes its instance variables
• The getYear() method is optional and it returns the year of the caseDate.
More specifics are given in code files as comments.
Design Constraint: Use of Collection classes (A
ayLists, LinkedLists, Sets, Maps, etc.) is not allowed in HW1
Instructions:
95712-Fall 2023 HW1
3
• Download the files from Canvas and store them in a project and a
package as shown in Fig. 2.
• Complete your code.
• It is expected that you follow the design provided and do not add new
classes, methods, or member variables. Making any design changes
may impact test-cases and may also need rework for you in
HW2/HW3.
• Write your name and Andrew id as comments at the top in all your
Java files.
• You will test your program in two ways: Console output (refer sample
outputs at the end of this document) and TestCyberCop.java. These
two tests will get you 80% of the points. Other criteria applied to
evaluate your program are:
1. Documentation (5%): Your code should be well-commented, i.e., neither Figure 2: Folder structure
too many comments, nor too few. Yes, this requires a little bit of your
judgment! Name your variables in a self-explanatory way. Write your name and Andrew id at the top in
the comments in each class. Indent your code properly. (In Eclipse, press Ctrl-A to select all your code
and then Ctrl-I to indent)
2. Code quality (5%): coding conventions, no unused variables/li
aries, etc. Use your judgment to assess
these criteria.
3. Code robustness (5%): Your program should not throw any e
ors while processing. You can safely
assume that the user will not enter any ga
age input.
4. Submission instructions (5%): Zip all your java files except test-file into AndrewId-hw1.zip. Do not
submit any other folders, class files, test file, text files, and rest of your kitchen sink! Only last
submission will be graded. Wrong files, inco
ect package name, etc. may take away some points.
NO LATE SUBMISSIONS PLEASE! If you are unable to submit on time, you lose all the points. Please avoid last
minute submission as Canvas may decide to quit on you! Learn to trust technology only to the extent you
should! Do not take that