Git Product home page Git Product logo

bootcamp-week4-challenge's Introduction

Financial Analysis Console App

JavaScript Fundamentals: Console Finances

Table of contents

Overview

In this challenge, you'll be using the concepts you've learned to complete the required activity. This activity presents a real-world situation in which your newfound JavaScript skills will come in handy. You are tasked with creating code for analyzing the financial records of a company. You have been provided with a financial dataset in the starter/index.js file.

The challenge

You have been given a dataset composed of arrays with two fields, Date and Profit/Losses.

Your task is to write JavaScript code that analyzes the records to calculate each of the following:

  • The total number of months included in the dataset.

  • The net total amount of Profit/Losses over the entire period.

  • The average of the changes in Profit/Losses over the entire period.

    • You will need to track what the total change in profits are from month to month and then find the average.
    • (Total/Number of months)
  • The greatest increase in profits (date and amount) over the entire period.

  • The greatest decrease in losses (date and amount) over the entire period.

When you open your code in the browser your resulting analysis should look similar to the following:

Financial Analysis
----------------------------
Total Months: 25
Total: $2561231
Average  Change: $-2315.12
Greatest Increase in Profits: Feb-2012 ($1926159)
Greatest Decrease in Profits: Sep-2013 ($-2196167)

Your final code should print the analysis to the console.

Screenshots

Financial Analysis console output

Financial Analysis alert output

Financial Analysis Output

    Financial Analysis
------------------------------------------------------------------------
    Total Months: 86
    Total: $38,382,578.00
    Average Change: -$2,315.12
    Greatest Increase in Profits: Feb-2012 ($1,926,159.00)
    Greatest Decrease in Profits: Sep-2013 (-$2,196,167.00)
------------------------------------------------------------------------

Links

My process

I used

Built with

  • Semantic HTML5 markup
  • CSS custom properties
  • Vanilla JavaScript

What I learned

A good understanding on how to use string formatter to output numbers with thousands and decimals, and include their currencies following the internationalization standards.

const formatter = new Intl.NumberFormat('en-US', {
  style: 'currency',
  currency: 'USD',
});
const str = formatter.format(1500);
console.log(str)

Continued development

  • Improve the UX/UI creating a website to display the financial analysis.
  • Create CRUD features to operate with the dataset.
  • Create an API to decouple data from presentation.

Useful resources

Author

Daniel Rodriguez

Acknowledgments

The teacher and TAs that help us with resources and support to my questions during the development of this challenge.

bootcamp-week4-challenge's People

Contributors

technoveltyco avatar

Stargazers

Roman avatar

Watchers

 avatar

bootcamp-week4-challenge's Issues

Base code

Base code

User Story

As a boot camp student,
I want to set up the repo folder structure for the week 4 challenge,
so I can create the Console Finances app.

Acceptance Criteria

  • It's done when there is a docs folder with the starter/ folder and files and the README.md file from the week 4 challenge.
  • It's done when you copy the files index.html and index.js into the root folder of the project.
  • It's done when there is README.md file at the root folder of the project, and contains the markdown template provided for the week 4 challenge.

Total amount of Profit/Losses

Total amount of Profit/Losses

User Story

As a financial advisor,
I want to calculate the net total amount of Profit/Losses over the entire period,
so I can see the final result in the Financial Analysis.

Acceptance Criteria

  • It's done when the total is calculated by adding all the profits and losses in the dataset.
  • It's done when the total result is displayed as Total: $12345.67 in the financial analysis output.

Financial Analysis output

Financial Analysis output

User Story

As a financial advisor,
I want to see the amounts formatted with 2 decimals and their currencies,
so I can see the final amounts more clearer in the Financial Analysis.

Acceptance Criteria

  • It's done when the total net amount outputs Total: $2,561,231.00.
  • It's done when the average total rate of change outputs Average Change: $2,561.00.
  • It's done when the greatest transaction outputs Greatest Increase in Profits: Feb-2017 ($2,561,231.00).
  • It's done when the lowest transaction outputs Greatest Decrease in Profits: Feb-2017 (-$1,561,231.00).

Deployment

Deployment

User Story

As a boot camp teacher,
I want to see the week 4 challenge in a public URL,
so I can score the work done.

Acceptance Criteria

  • It's done when the final code is deployed to a public URL in GitHub Pages.
  • It's done when the repo and live site URLs are submitted to the teacher.

Main workflow

Main workflow

User Story

As a boot camp student,
create the main function,
so the program has an entry point to execute.

Acceptance Criteria

  • It's done when there is a function called main and executes as the first line of the program.
  • It's done when there are functions that support the operation executed in the main workflow.

Average of the changes in Profit/Losses

Average of the changes in Profit/Losses

User Story

As a financial advisor,
I want to calculate the average of the changes in Profit/Losses over the entire period,
so I can see the final result in the Financial Analysis.

Acceptance Criteria

  • It's done when the total average is calculated by total ROC / total of months.
  • It's done when the total result is displayed as Average Change: $12345.67 in the financial analysis output.

Refactor the greatest increase in profits

Refactor the greatest increase in profits

User Story

As a boot camp student,
I want to correct the calculation of the greatest increase in profits,
so the Finacial Analysis outputs the correct transaction (date and value).

Acceptance Criteria

  • It's done when the greatest increase in profits matches the transaction corresponding with the greatest rate of change (RoC).
  • It's done when the Financial Analysis outputs the correct value.

Greatest decrease in losses

Greatest decrease in losses

User Story

As a financial advisor,
I want to calculate the greatest decrease in profits (date and amount) over the entire period,
so I can see the final result in the Financial Analysis.

Acceptance Criteria

  • It's done when finding the transaction (date and amount) with the lowest amount over the entire dataset.
  • It's done when the lowest transaction (date and amount) is displayed as Greatest Decrease in Profits: Feb-2017 ($-12345.67) in the financial analysis output.

Greatest increase in profits

Greatest increase in profits

User Story

As a financial advisor,
I want to calculate the greatest increase in profits (date and amount) over the entire period,
so I can see the final result in the Financial Analysis.

Acceptance Criteria

  • It's done when finding the transaction (date and amount) with the greatest amount over the entire dataset.
  • It's done when the greatest transaction (date and amount) is displayed as Greatest Increase in Profits: Feb-2017 ($12345.67) in the financial analysis output.

README

README

User Story

As a boot camp teacher,
I want to see detailed documentation of the boot camp week 4 challenge,
so I can score the work done.

Acceptance Criteria

  • It's done when all the sections from the README template contain documentation of the week 4 challenge.

Code refactor improvements

Code refactor improvements

User Story

As a financial advisor,
I want to have a feature to access the Financial Analysis,
so I can see the report on the website.

Acceptance Criteria

  • It's done when the Financial Analysis outputs in the browser console tool.
  • It's done when the user can see the same Financial Analysis console output in the website without opening the browser console.

Refactor Average Change in Profit/Losses

Refactor Average Change in Profit/Losses

User Story

As a boot camp student,
I want to correct the calculation of the rate of change,
so the Finacial Analysis outputs the correct average change value.

Acceptance Criteria

  • It's done when the rate of change (RoC) does not apply Math.abs() to the transaction amounts difference.
  • It's done when all rates of change (RoC) are stored in a variable than can be reused for future calculations.
  • It's done when the Financial Analysis outputs the correct average change value.

Refactor the greatest decrease in profits

Refactor the greatest decrease in profits

User Story

As a boot camp student,
I want to correct the calculation of the greatest decrease in profits,
so the Finacial Analysis outputs the correct transaction (date and value).

Acceptance Criteria

  • It's done when the greatest decrease in profits matches the transaction corresponding with the smallest rate of change (RoC).
  • It's done when the Financial Analysis outputs the correct value.

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.