Giter Club home page Giter Club logo

granicusassessment's Introduction

About this Project

This project contains several text files, a single Java library file, and a single unit test file. The code, unit test, and data files will be the focus of this coding exercise.

Volunteers Needed!

A local food shelf needs more volunteers to help bag rice. The food shelf has multiple locations where people volunteer on the same days each week.

At the end of every week, each location submits a report showing how many volunteers they had and how many bags of rice were produced each day. But they're not always reaching their goals, and some people are going hungry!

They need to know how many more volunteers to recruit each week, so we wrote a program to calculate this for them. But it's not working correctly.

Here is an example location report:

Volunteers Goal Bags Actual Bags
10 50 30
15 45 44
20 55 40
22 14 14

Based on this report file the extra volunteers needed per day are calculated as follows:

  • Bags Still Needed = Goal Bags - Actual Bags
  • Bags Stocked Per Volunteer = Actual Bags / Volunteers
  • Volunteers Needed = Bags Still Needed / Bags Stocked Per Volunteer

Input

There are two food_shelf_*.txt files in this project. The contents are described as follows:

  • The first line of the input is a single line containing comma-separated headers (volunteers, goal bags, actual bags)
  • The next N lines each contain comma-separated data for a day of the week.

Output

For each test case, the script should output N-1 lines. Each line should contain the volunteers needed for each day of the week in the food shelf input file, one per line.

Before you begin

(Take Home only) Please note there is a DISCUSSION.md file included in this project. You are encouraged to add discussion points to this file as you progress as if you were pairing with another engineer. Examples could include steps you took to solve the problem or alternative possibilities that you considered and why you chose not to use them.

Running the Program

ant run -Dfile=src/resources/food_shelf_north.txt

Running the Tests

ant test

Problems

Problem #1

There's a bug in our code and a unit test is failing. Run the tests to identify the problem, then fix the code so the unit tests pass and the program works correctly again.

Problem #2

Locations would like to include the day of the week with their reports, so it's clear what day each row applies to. Update the code so that it can handle day names in the .txt report files and include them in the results. Make sure the existing report format (without day of the week) is still supported.

Problem #3

Sort the results in descending order, based on volunteers needed.

Problem #4

How would you refactor this program to improve it? Implement a few of your ideas.

granicusassessment's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.