Option #1: Program 2 (Exercise #8)

Create an appropriate Java Postfix calculator class (Carrano & Henry, 2015, p. 177). Your program should accept at least five elements (data1, data2, data3, data4, data5) and perform an appropriate postfix operation given the following scenarios:

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper
  • data1 data + data3 * data4 –
  • data1 data * data3 * data1 – / data4 data5* +

Use the following values for each input:

data1 = 1;data2 = 2;data3 = 4data4 = 5data5 = 3

Ensure that your program has the required class and a test class. Submit Exercise 8 and screenshots of your program’s execution and output compiled into a single document. Also attach all appropriate source code in a zip file.

Carrano, F. M., & Henry, T. (2015). Data structures and abstractions with Java (4th ed.). Upper Saddle River, NJ: Pearson.

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

7. Using the algorithm convertToPostfix, given in Segment 5.16, convert each of the following infix expres-
sions to postfix expressions:
a. a*b/(c-d)
b. (a – b* c)/(d* e* f+g)
c. a/b* (c + (d – e))
d. (a^b* -d)^e+f^g^h
8. Using the algorithm evaluatePostfix, given in Segment 5.18, evaluate each of the following postfix expres-
sions. Assume that a = 2, b = 3, c = 4, d = 5, and e = 6.
a. a b + c d-
b. ab*ca- / de* +
c. a c-b1d +
9. What infix expressions are represented by the postfix expressions given in the previous exercise?
10. Show the contents of the two stacks as you trace the algorithm evaluate Infix, given in Segment 5.21, to
evaluate each of the following infix expressions. Assume that a = 2, b = 3, c = 4, d = 5, e = 6, and f = 7.
a. (a + b)/(c-d) – 5
b. (d * f+1) * e/(
ab-b* C+1) – 72
с. (алс-f) ла-алbла
11. A palindrome is a string of characters (a word, phrase, or sentence) that is the same regardless of whether
you read it forward or backward assuming that you ignore spaces, punctuation, and case. For example,
Race car is a palindrome. So is A man, a plan, a canal: Panama. Describe how you could use a stack to test
whether a string is a palindrome.

Still stressed from student homework?
Get quality assistance from academic writers!

Order your essay today and save 25% with the discount code LAVENDER