Code Monkey home page Code Monkey logo

tipcalculator's Introduction

Tip Calculator Demo

This is a simple tip calculator to assist users with calculating and splitting bills.

Time spent: 8-9 hours in total

Completed user stories:

  • Required: User can input a bill amount and see both the tip amount and total amount for three different tip percentages.
  • Required: User can go to the settings page and change their three standard tip amounts (for bad, average, and great service, respectively). These modified tip amounts will persist across sessions.
  • Optional: The app remembers the bill amount used most recently, except when the app was not used in the last 10 minutes.
  • Optional: The app also includes a feature for groups to determine the amount each person should pay to split the bill.
  • Optional: The app automatically updates all data while the user is typing.
  • Optional: The app works flawlessly across different locales and handles commas, periods, and currency symbols correctly.
  • Optional: Everything is purple ;)

Notes:

I chose to increase the font size of the bill amount since it's the only number the user actually inputs. I also moved the tip selector up higher to be right under the actual tip amount.

For the settings I chose to allow the user to change his/her default tip percentages, since I felt this was the setting where people would most likely have different preferences.

I spent the longest time on getting the calculator to work perfectly with any locale/currency. My eventual solution involved using an NSNumberFormatter in NSNumberFormatterCurrencyStyle mode with lenient set to YES. Using this actually enabled me to set up functions to parse numerical amounts out of strings and convert numbers into monetary strings. These functions ended up being extremely useful within my code, since they abstracted out most of the dirty work. (In general, I tried to abstract out redundant code wherever possible.)

Walkthrough of all user stories:

Video Walkthrough

GIF created with LiceCap.

tipcalculator's People

Contributors

nealwu avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

hyzzd

tipcalculator's Issues

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.