Skip to content

Madhukar07565/CategoryDemo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CategoryDemo

Category and SubCategory System

We need to pass the file name as argument.

Prerequisites:

  1. Java version greater than or equal 1.7
  2. Gradle

External libraries used :

  1. commons-collections
  2. Junit

Algorithm:

  1. Read each line from the file
  2. And get the category and subcategory
  3. Once you get category, sub category add these to Category object
  4. Check for the duplicates if not present then add the category object to category list
  5. By using Category list print the categoryCountMap and categories to console

How to run:

  1. Run from the IDE Run as java application CategoryDemo by passing the filename as argument

OR

  1. gradle clean test buildJar - it will generate the jar file

    java -jar CategoryDemo-1.0.jar 'inputfile'
    e.g : java -jar CategoryDemo-1.0.jar C:\ValidCategeroyset.txt

####File Input:

  • PERSON Bob Jones
  • PLACE Washington
  • PERSON Mary
  • COMPUTER Mac
  • PERSON Bob Jones
  • OTHER Tree
  • ANIMAL Dog
  • PLACE Texas
  • FOOD Steak
  • ANIMAL Cat

####Output: Category Count
PERSON 2
PLACE 2
ANIMAL 2
COMPUTER 1
OTHER 1

PERSON Bob Jones
PLACE Washington
PERSON Mary
COMPUTER Mac
OTHER Tree
ANIMAL Dog
PLACE Texas
ANIMAL Cat

###Code Coverage:

Run the below command to get the code coverage report

gradle clean test jacocoTestReport

alt text

###PMD: Verified the code with PMD check and not found any critical violations(except the one which are related to System.out.println(), which is required in this program)

About

Category and SubCategory System

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages