Đã Hủy

variable-calculator in java

The goal is to create a simple calculator that reads the input in the "common" notation (the infix notation).

The input is read from the standard input. The results are printed out to the standard output. The calculator allows for summing, subtracting, multiplying, and dividing. Priority of the operators is as usual and can be modified by the parentheses.

The numbers correspond to the Double type. The numbers can be written in any format that is acceptable by the [url removed, login to view]() method. The numbers can be negative (i.e., the unary minus can be used, too; the parseDouble() method can also read the unary minus). Also, take care about a number format with an exponent, the exponent written with a sign, etc.

In addition to numbers, the calculator allows for using variables. Variables are identified by a case-sensitive sequence of letters. A value is assigned to a variable by operator = (the equals sign). The value of a variable used for the first time in an expression is zero. Assigning a value to a variable is not an expression (i.e., it cannot be used in other expressions).

A value of a just-evaluated expression is always assigned to the special variable last, which can be used in the subsequent expression (in the first expression, the value of the last variable is zero). After assigning a value to a variable, the same value is also stored into last.

The expressions are separated by a new-line. Within a single line, numbers and operators are separated by an arbitrary number of white spaces (with the exception of the new-line). The result is printed out after the complete expression is read. If the given expression contains an error (an insufficient number of operands for an operator, insufficient operators for given operands, an unknown operator, a wrong number format, an invalid operation,...), the program prints out string ERROR. An empty line (or a line with white spaces only) is not considered as an error and it is ignored.

After printing out string ERROR, the last variable contains zero.

The results are printed out with the precision of 5 digits (i.e., 5 digits after the decimal point; the numbers can be printed out for example by the [url removed, login to view]("%.5f", number) method).

The program ends with the end of the input.

Ex: if Input:

3 + 2

1e2

2 * ( 3 + 1 )

1.2 + 4.3

3 ** 5

5 / 3

Output:

5.00000

100.00000

8.00000

5.50000

ERROR

1.66667

Kĩ năng: Java, Programming

Xem nhiều hơn: yntax error, unexpected end of file, expecting variable (T_VARIABLE) or heredoc end (T_END_HEREDOC) or ${ (T_DOLLAR_OPEN_CURLY_B, special needs calculator, complete program simple gui calculator java, simple processing calculator end, multiple variable calculator, virtuemart price calculator front end, iphone special calculator app, variable width calculator, multiple variable limit calculator, multiple variable equation calculator, gui calculator java complete report, complete mortgage calculator java file read interest rates fill array sequential file , special calculator, need special calculator website, change flash variable end animation, mortgage calculator java using gui, mortgage payment calculator java graphical user interface, fix warning end passed variable array object, btu calculator java, mortgage payment calculator java, write arrays mortgage calculator java, paint calculator java script, credit card calculator java script, blinds cost calculator java script, time value money calculator java script code

Về Bên Thuê:
( 1 Nhận xét ) Praha, Czech Republic

ID dự án: #16012394

10 freelancer đang chào giá trung bình ₹1365 cho công việc này

₹2500 INR trong 2 ngày
(250 Nhận xét)
7.0
Shankarone

I can complete this work in 6 hours time. Let me know if you'd like me to start working. Relevant Skills and Experience . Proposed Milestones ₹1300 INR - task completion

₹1300 INR trong 1 ngày
(23 Nhận xét)
4.6
BeshoyMousaKhair

. Relevant Skills and Experience . Proposed Milestones ₹1500 INR - .

₹1500 INR trong 1 ngày
(29 Nhận xét)
4.2
amoldevadhe3

Hello, We have good experience of PHP,HTML,CSS, Ajax,JavaScript,Mysql, Website Design,Bootstrap, etc. Kindly give us an opportunity to work for you at our best. Thank you !! Relevant Skills and Experience Java, Progra Thêm

₹1300 INR trong 1 ngày
(10 Nhận xét)
3.2
₹1500 INR trong 1 ngày
(5 Nhận xét)
3.2
AmerSOthman94

Kindly, be advised that I do the potential and the skills required to accomplish this task with clear and solid code. Relevant Skills and Experience Java Object-oriented programmming XML (eXtensible Markup Language) M Thêm

₹1300 INR trong 1 ngày
(3 Nhận xét)
2.9
AMancer

hello i'm a java developer , i read your description . please contact me soon over chat thank you. Relevant Skills and Experience JAVA Proposed Milestones ₹1300 INR - project milestone

₹1300 INR trong 1 ngày
(4 Nhận xét)
2.6
₹1050 INR trong 1 ngày
(1 Nhận xét)
0.8
₹600 INR trong 1 ngày
(0 Nhận xét)
0.0
₹1300 INR trong 1 ngày
(0 Nhận xét)
0.0