Skip to content

rohanrp/codingChallenge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rohan Pereira's Coding Challenge for Papercut

This application seeks to calculate the pricing of individual printing jobs for PaperCut. Print job data is read in through a CSV file and is then processed to display the pricing information for print job(s).

This app is lightweight and very extensible through liberal use of interfaces and a flexible rules engine.

The problem statement for this coding challenge is found under a file called problem.md

Stack

  • Java 8 - lambdas, functional programming and streams
  • Spring Boot
  • Maven
  • EasyRules - a java rules engine

In a nutshell

  • The program uses spring boot to quickly auto configure all the beans needed for the container.
  • The init class is PrintJobConsoleRunner. It reads a print job csv file and maps them to a list of print job objects
  • The print jobs are then sent to a pricing rules engine to determine the pricing algorithm for each print job
  • When all algorithms have been determined, each print job will be executed against the algorithm that is stored against it

Instructions

  • Download and install JDK 1.8
  • Set up Maven and point to a public repository for dependencies.
  • Run a 'mvn clean install' on the pom to ensure you see a successful build
  • Open the project in Eclipse as an existing maven application
  • Ensure your Eclipse is on JRE8
  • Run the Application class as a Java Application on Eclipse. It will output some pricing data to the console.
  • Muck around with the Junit tests.

Improvements

  • The rules engine could be made more dynamic i.e. to allow rules to be modified without compiling again
  • Better exception handing. The exceptions could be more detailed.
  • Concurrency. A little bit more work can be done to ensure the app can handle multi-threading efficiently.

Sample Console Output

Total Cost of All Print JOBS+++++++++++++++++++++++

+++ $ 64.10

++++++++++++++

Breakdown of costs by job++++++++++++++++++++++++++

+++PrintJob {Id='0', Total Pages='25', Total Colour Pages='10', Paper Size='A4', Paper siding='SINGLE'}: $ 4.75

+++PrintJob {Id='1', Total Pages='55', Total Colour Pages='13', Paper Size='A4', Paper siding='DOUBLE'}: $ 6.80

+++PrintJob {Id='2', Total Pages='502', Total Colour Pages='22', Paper Size='A4', Paper siding='DOUBLE'}: $ 52.40

+++PrintJob {Id='3', Total Pages='1', Total Colour Pages='0', Paper Size='A4', Paper siding='SINGLE'}: $ 0.15

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages