Skip to content

Mavar3/Calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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" не допустимо
  • деление на ноль не допустимо

About

My first app on Java

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors