GithubHelp home page GithubHelp logo

mawais54013 / tipper-project Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 1 MB

Having a difficult time figuring out how much to tip or how much to split the bill, just use this app to make it easier on yourself.

Home Page: https://tipper-app.herokuapp.com/

HTML 11.60% CSS 13.22% JavaScript 75.18%

tipper-project's Introduction

Added Datadog to this project

Tipper-App

This is a very simple tip calculator application built with React, Javascript, and Heroku. Having a difficult time figuring out how much to tip or how much to split the bill, just use this app to make it easier on yourself.

index

Getting Started

Site Link: Tipper-App

Just enter the total bill, tip percentage, and the number of people that bill should be split with and the total will be revealed.

Note that the app will only calculate the total for positive numbers, so users will get a error message if user types a letter or negative numbers.

Prerequisites

Your can access the site from any interest browser including Google Chrome, Firefox, or Safari.

Deployment

This site is deployed through heroku.

Built With

  • React js
  • Javascript
  • CSS
  • Heroku

Code Sample

let tipNum = (parseFloat(this.state.value) * (parseInt(this.state.tip) / 100)) / parseInt(this.state.people) + 0.00;

let tipTotal = parseFloat(tipNum).toFixed(2);

let totalNum = (parseFloat(this.state.value) + (parseFloat(tipTotal) * parseInt(this.state.people))) / parseInt(this.state.people);

let fullTotal;

if (isNaN(totalNum) || totalNum < 0) {
    tipTotal = 'All fields must be positive numbers';
    fullTotal = 'All fields must be positive numbers';
}

The code above shows the tip is calculated and then the tip total is used to calculated the total among the people into full total. After we check to see if totalNum is either a negative or is not a number and if that is the case it returns a error message.

Author

Muhammad - https://github.com/mawais54013

tipper-project's People

Contributors

mawais54013 avatar

Watchers

James Cloos 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.