Em Andamento

expr

Code a Java application program using a class named Expr to operate on expressions as described**. The Unix command expr treats its command line argument as an expression to be evaluated and prints the resulting value. The Unix man page includes the following description. The expr utility will evaluate the expression and write the result to standard output. Arguments are taken as an expression. Terms of the expression must be separated by blanks. Characters special to the shell must be escaped The Unix command supports a variety of operators with several precedence levels. Your application will support only the operators +, -, x, and d. 'x' is used in place of '*' for multiplication and 'd' in place of '/'for division to avoid conflicts with command interpreter special usage. Standard associativity and precedence apply. Operands must be integer constants and may optionally have a minus sign. In addition, if the program is run with no parameters, it is to print the message shown in the example below, but with your name rather than mine. Here are some simple examples. $java Expr 1 + 2 3 $java Expr 1 + 2 x 3 7 $java Expr 1 + 6 d 3 x 2 5 $java Expr Java Expr programmed by (name) Observe that the Java interpreter takes the values following the class name and places them in an array of strings that is passed as the argument value for main. You just use those values, you do not have to read anything within your program.

## Deliverables

1) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done. 2) Installation package that will install the software (in ready-to-run condition) on the platform(s) specified in this bid request. 3) Complete ownership and distribution copyrights to all work purchased. 4) [url removed, login to view] source file 5) Output showing thorough testing of the program from the command line so that both the command and the corresponding output are shown 6) The [url removed, login to view] file Make sure the permissions on the directories and the file are correctly set as described Design hint The following algorithm is commonly given as an example of the use of a stack in data structures texts, though with more complex expressions. A simple way to handle precedence is to use two stacks, one for the operators and one for the operands. Start by pushing some distinctive symbol onto the operator stack to mark the beginning of the expression. This symbol is considered to have very low precedence. Then push the first operand onto the operand stack. Then repeat the following process. 1. If the next operator in the input has precedence less than or equal to the one on the top of the operator stack, apply the operator on the top of the stack to the two operands on top of the operand stack and push the result back onto the operand stack. Pop the operator off the stack and repeat this step. 2. If the next operator has higher precedence than the one on top of the operator stack, push it onto the operator stack and push the next operand onto the operand stack. 3. When input is complete, repeatedly apply the evaluation process of step 1 until only the beginning-of-expression operand is left on the operator stack. The value on the operand stack is the result. You can use arrays to implement the stacks or you can use the Java Stack class. You can assume that there are no more than 50 operators and 50 operands in an expression.

## Platform

WINDOWS and LINUX

Habilidades: Engenharia, Java, Linux, Microsoft, MySQL, PHP, Arquitetura de software, Teste de Software, UNIX, Área de trabalho do Windows

Ver mais: using stack in java example, using expressions, use of data structures, used structures, strings for c standard, stacks and stacks, stack in data structures, stack data structures, stack class java, software stacks, simple algorithm examples in c, simple algorithm example, set data structures, push algorithm, program algorithm example, php source code testing software name, line algorithm, java stack class, java data structures examples, java command line application, examples of data structures, examples of an algorithm, example of an algorithm, example of algorithm, design argument

Acerca do Empregador:
( 16 comentários ) United States

ID do Projeto: #2973519

Premiar a:

mstrocan

See private message.

$21.25 USD em 4 dias
(65 Avaliações)
4.7

28 freelancers estão ofertando em média $50 para este trabalho

slimbvw

See private message.

$42.5 USD in 4 dias
(166 Comentários)
7.5
ndima

See private message.

$6.8 USD in 4 dias
(96 Comentários)
6.6
mihaiscortaru

See private message.

$42.49 USD in 4 dias
(160 Comentários)
6.0
emilianbold

See private message.

$5.1 USD in 4 dias
(80 Comentários)
5.9
ziksainc

See private message.

$12.75 USD in 4 dias
(62 Comentários)
5.2
stojoman

See private message.

$17 USD in 4 dias
(44 Comentários)
4.6
bluejohn

See private message.

$12.75 USD in 4 dias
(9 Comentários)
4.5
vw821235vw

See private message.

$19.55 USD in 4 dias
(94 Comentários)
4.3
seirus

See private message.

$6.8 USD in 4 dias
(36 Comentários)
4.0
amotazvw

See private message.

$17 USD in 4 dias
(34 Comentários)
4.0
shashikhanvw

See private message.

$680 USD in 4 dias
(15 Comentários)
3.8
gmorkster2

See private message.

$8.5 USD in 4 dias
(16 Comentários)
3.9
always99vw

See private message.

$10.2 USD in 4 dias
(22 Comentários)
3.4
stephennaicken

See private message.

$17 USD in 4 dias
(6 Comentários)
2.7
ciphereye

See private message.

$11.05 USD in 4 dias
(16 Comentários)
2.7
viktorgvw

See private message.

$25.5 USD in 4 dias
(6 Comentários)
2.0
aoavw

See private message.

$6.8 USD in 4 dias
(8 Comentários)
1.8
blazerfrost

See private message.

$6.8 USD in 4 dias
(5 Comentários)
1.5
foodaddy

See private message.

$4.25 USD in 4 dias
(6 Comentários)
1.1
amitmarwaha

See private message.

$170 USD in 4 dias
(1 Comentário)
0.0