GithubHelp home page GithubHelp logo

calculator's Introduction

Calculator

My first app on Java

The Task:
--------------------------------------------------------------------------------------------------------------------------------
Eng
A string like "5 + 10 * 25 - 70/35" comes to the input of the program the task of the program is to calculate the value of the entered expression, taking into account the priority of operations

restrictions

  • a string of arbitrary length
  • arbitrary rational numbers, the separator of the integer and fractional parts is a dot
  • fractional numbers are always written in the format . , i.e. it is allowed to write "45.3323" or "0.134", but not allowed ".234"
  • it is possible to write a number with leading zeros or trailing zeros in the fractional part, i.e. numbers "024" and "24.5000" are allowed
  • disregard the unary minus, i.e. an entry like "5 + -10" is invalid, just as the entry "-5 + 10" is invalid
  • 4 operations are supported - addition, subtraction, multiplication, division
  • calculation is performed taking into account the priority of operations
  • you cannot change the priority with parentheses, i.e. parentheses are not allowed
  • between numbers and arithmetic signs, an arbitrary number of spaces is allowed
  • spaces are not allowed inside a number, i.e. the number "1000" is not allowed
  • division by zero is not allowed

Rus
На вход программы поступает строка вида "5+10*25 - 70 / 35" задача программы - вычислить значение введенного выражения с учетом приоритета операций

ограничения

  • строка произвольной длины
  • произвольные рациональные числа, разделитель целой и дробной части - точка
  • дробные числа пишутся всегда в формате <целая часть>.<дробная часть>, т.е. допустимо написать "45.3323" или "0.134", но не допустимо ".234"
  • возможна запись числа с лидирующими нулями или замыкающими нулями в дробной части, т.е. числа "024" и "24.5000" допустимы
  • унарный минус не учитывать, т.е. запись типа "5 + -10" недопустима, так же как недопустима запись "-5 + 10"
  • поддерживаются 4 операции - сложение, вычитание, умножение, деление
  • вычисление происходит с учетом приоритета операций
  • менять приоритет скобками нельзя, т.е. скобки недопустимы
  • между числами и арифметическими знаками допустимо произвольное число пробелов
  • пробелы недопустимы внутри числа, т.е. число "1 000" не допустимо
  • деление на ноль не допустимо

calculator's People

Contributors

mavar3 avatar

Watchers

 avatar  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.