Write a program which accepts a space-delimited set of


PROGRAMMING ASSIGNMENT

FUNCTIONAL PROGRAMMING

INFIX EXPRESSION CALCULATOR

PRELIMINARY NOTES

You have your choice of programming languages for this assignment:

• Scheme (or Clojure)
• Ocaml (or F#)
• Java 8 (utilizing the "Functional Programming" features of the language
• Scala

RULES

(NOTE: Since a choice of languages is given, the "rules" have to remain flexible, hence the use of where applicable in several of the rules below.)

• Must use "High Order Functions" where applicable.
• The only permitted "looping constructs" are:

o Recursion
o Streams, Maps, Folds
o In some pure functional languages, these would be your only options

• Must use "strong" and proper datatypes where applicable

o For example each kind of operator would be its own type.

- (E.g. Addition and Subtraction would both be instances of an "Additive" type, but Multiplication and Division would be instances of a "Multiplicative type")

- In other words, each "precedence level" should be represented by its own type.

• Should use floating-point input and evaluation.

PROGRAM DESCRIPTION

1. Write a program which accepts a space-delimited set of symbols representing an infix arithmetic expression as described below.

a. The user should be prompted for the input (to be entered via keyboard)

2. Output:

a. The numeric evaluation of the expression
b. A string representing the arithmetic expression as an S-Expression

i. Hint: Easily generated from a simple pre-order tree traversal
ii. Note that any parentheses in the original input should not appear in the output (ie. Duplicating parentheses).

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: Write a program which accepts a space-delimited set of
Reference No:- TGS01677987

Expected delivery within 24 Hours