/Epicodus_Super-Galactic-Age-Calculator

A solar year lasts 365 days on planet Earth. However, the length of a solar year varies from planet to planet. For instance, a solar year on Mercury lasts 88 days. Write an application that determines a user’s age based on a planet’s solar years. You are not required to build a UI for this application. Instead, focus on thoroughly testing each piece of functionality. Make sure to commit a TDD spec before writing the corresponding method; in this way, you'll be following a Red, Green, Refactor workflow. Remember to include at least one test for each spec and that, typically, we'll only want one expectation per test. The business logic of your application should: Take a person’s age in years and create a class that does the following: Returns their age in Mercury years. (A Mercury year is .24 Earth years.) Returns their age in Venus years. (A Venus year is .62 Earth years.) Returns their age in Mars years. (A Mars year is 1.88 Earth years.) Returns their age in Jupiter years. (A Jupiter year is 11.86 Earth years.) Determines how many years a user has left to live on each planet… (yikes!) To do this, the application will have to calculate the user’s life expectancy. You can determine average life expectancy as you see fit. A simple way to do this would be to have the user input the average life expectancy for their demographic. A more involved way to do this would be to collect other information from the user (e.g. lifestyle, country of residence, activity level, etc.) to determine their life expectancy. If a user has already surpassed the average life expectancy, return the number of years they have lived past the life expectancy.

Primary LanguageJavaScript

Super Galactic Age Calculator

An application that determines a user’s age based on a planet’s solar years. , Feb 2020

By Benjamin Thom

Description

A user inputs their age in earth years and the application will display the following:

  • The user's age in Mercury years. (A Mercury year is .24 Earth years or approximatley 88 Earth days)
  • The user's age in Venus years. (A Venus year is .62 Earth years or approximatley 225 Earth days)
  • The user's age in Mars years. (A Mars year is 1.88 Earth years or approximatley 687 Earth days)
  • The user's age in Jupiter years. (A Jupiter year is 11.86 Earth years or approximatley 12 Earth days)
  • The application also determines how many years a user has left to live on each planet…
  • If a user has already surpassed the average life expectancy, the application will display the number of years they have lived past the life expectancy.

Project Specifications

Behavior Input Output
User inputs their date of birth as a number 29 29
Return age in Mercury's Earth years 29 120
Return age in Venus's Earth years 29 47
Return age in Mars's Earth years 29 15
Return age in Jupiter's Earth years 29 2
Return the number of years the user has to live based on U.S. 2020 average lifespan 78.93 in Earth years 29 49
Return the number of years the user has to live based on U.S. 2020 average lifespan 78.93 in Mercury's Earth years 29 207
Return the number of years the user has to live based on U.S. 2020 average lifespan 78.93 in Venus's Earth years 29 80
Return the number of years the user has to live based on U.S. 2020 average lifespan 78.93 in Mars's Earth years 29 26
Return the number of years the user has to live based on U.S. 2020 average lifespan 78.93 in Jupiter's Earth years 29 4
If a user's age surpasses the global average lifespan 78.93 it will convert the amount of years they have lived over the average to Earth years 82 -4
If a user's age surpasses the global average lifespan 78.93 it will convert the amount of years they have lived over the average to Mercury's Earth years 82 -13
If a user's age surpasses the global average lifespan 78.93 it will convert the amount of years they have lived over the average to Venus's Earth years 82 -5
If a user's age surpasses the global average lifespan 78.93 it will convert the amount of years they have lived over the average to Mars's Earth years 82 -2
If a user's age surpasses the global average lifespan 78.93 it will convert the amount of years they have lived over the average to Jupiter's Earth years 82 -1

Setup/Installation Requirements

In Terminal:

  • Navigate to where you want this application to be saved, i.e.: cd desktop
  • Clone the file from GitHub with HTTPS git clone https://github.com/benjamin-thompdx/Epicodus_Super-Galactic-Age-Calculator.git
  • Open file in your preferred text editor
  • On Mac: open -a {your text editor} Epicodus_Super-Galactic-Age-Calculator
  • On Windows: Epicodus_Super-Galactic-Age-Calculator

Download Manually:

Note For Editors:

  • Once cloned/downloaded, to run and make changes, in the terminal simply run $ npm install to download necessary dependencies. Then run $ npm run build to create your own dist folder with a bundle.js file.

Known Bugs

No known bugs at this time.

Support and contact details

Have a bug or an issue with this application? Open a new issue here on GitHub.

Technologies Used

  • Javascript
  • jQuery
  • Webpack
  • Node.js
  • Jest

License

MIT

Copyright (c) 2020 Benjamin Thom