Skip to content

geisson/calculator

Repository files navigation

Calculator

Tier: 1-Beginner

Calculators are not only one of the most useful tools available, but they are also a great way to understand UI and event processing in an application. In this problem you will create a calculator that supports basic arithmetic calculations on integers.

The styling is up to you so use your imagination and get creative! You might also find it worth your time to experiment with the calculator app on your mobile device to better understand basic functionality and edge cases.

Constraints

  • You may not use the eval() function to execute calculations

User Stories

  • User can see a display showing the current number entered or the result of the last operation. --( O usuário pode ver um display mostrando o número atual inserido ou o resultado da última operação. )

  • User can see an entry pad containing buttons for the digits 0-9, operations - '+', '-', '/', and '=', a 'C' button (for clear), and an 'AC' button (for clear all). -- ( O usuário pode ver um teclado de entrada contendo botões para os dígitos 0-9, operações - '+', '-', '/' e '=', um botão 'C' (para limpar) e um 'AC' )

  • User can enter numbers as sequences up to 8 digits long by clicking on digits in the entry pad. Entry of any digits more than 8 will be ignored. -- O usuário pode inserir números como sequências de até 8 dígitos clicando em dígitos no teclado de entrada. A entrada de qualquer dígito maior que 8 será ignorada.

  • User can click on an operation button to display the result of that operation on: -- ( O usuário pode clicar em um botão de operação para exibir o resultado dessa operação em: )

    • the result of the preceding operation and the last number entered OR --( o resultado da operação anterior e o último número inserido OU)
    • the last two numbers entered OR --( os dois últimos números inseridos OU )
    • the last number entered -- ( o último número digitado )
  • User can click the 'C' button to clear the last number or the last operation. If the users last entry was an operation the display will be updated to the value that preceded it. -- ( O usuário pode clicar no botão 'C' para limpar o último número ou o último Operação. Se a última entrada do usuário foi uma operação, o display será atualizado para o valor que o precedeu. )

  • User can click the 'AC' button to clear all internal work areas and to set the display to 0. --( O usuário pode clicar no botão 'AC' para limpar todas as áreas de trabalho internas e para definir o visor para 0. )

  • User can see 'ERR' displayed if any operation would exceed the 8 digit maximum. -- ( O usuário pode ver 'ERR' exibido se qualquer operação exceder o máximo de 8 dígitos. )

Bonus features

  • User can click a '+/-' button to change the sign of the number that is currently displayed. --( O usuário pode clicar em um botão '+/-' para alterar o sinal do número que está atualmente exibido. )
  • User can see a decimal point ('.') button on the entry pad to that allows floating point numbers up to 3 places to be entered and operations to be carried out to the maximum number of decimal places entered for any one number. -- ( O usuário pode ver um botão de ponto decimal ('.') no teclado de entrada para aquele permite que números de ponto flutuante de até 3 lugares sejam inseridos e operações para ser realizado com o número máximo de casas decimais inseridas para qualquer número. )

Useful links and resources

Example projects

About

calculator designed to train programming

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published