Calculate the result of each arithmetic expression

Assignment Help JAVA Programming
Reference no: EM132098893

Please make sure that these infix and postfix equations have these answers nothing else:

Infix:

(3 * 4 - (2 + 5)) * 4 / 2 = valid expression

10 + 6 * 11 -(3 * 2 + 14) / 2 = valid expression

Postfix:

9 3 / 6 / 4 * 10 - = -8

9 3 / 6 / 4 * -10 - = 12

(a) Using java.util.stack to write a java program to validate and calculate the result of each arithmetic Expression from input file (infix.dat). All equations from the input file are in traditional infix notation.

Display each expression first. Then, if the arithmetic expression is not valid, display "Invalid expression " message otherwise display the result of the calculation.

(b) Using java.util.Stack and java.util.StringTokenizer to write a java program to validate and calculate postfix expression from the input data file - postfix.dat

infix.dat

5 * 6 + 4
3 - 2 +
( 3 * 4 - (2 + 5)) * 4 / 2
10 + 6 * 11 -(3 * 2 + 14) / 2
2 * (12 + (3 + 5 ) * 2

postfix.dat

5 2 + 8 5 - *
2 4 - 5 2 * +
5 2 6 3 - * + 4 + 2 3 1 + * 7
5 0 /
9 3 / 6 / 4 * 10 - 3 / +
9 3 / 6 / 4 * 10 -
5 2 6 3 - * + 4 + 2 3 1 + * 7 - *
9 3 / 6 / 4 * -10 -

Reference no: EM132098893

Questions Cloud

Determine whether a given number is an armstrong number : Write a WinMIPS64 / EduMips64 code to determine whether a given number is an Armstrong number.
Calculate the nth term passed into the method : Calculate the nth term passed into the method. Save the value of the term in the instance attribute.
Calculate the total costs of the meals : Create an application such that when the user clicks a button, your program will first input 2 meal prices from the user.
How many bits were used to store each character : How many bits would it take to represent all of the lowercase letters in the Latin alphabet used for English?
Calculate the result of each arithmetic expression : Write a java program to validate and calculate the result of each arithmetic Expression from input file.
Advantage of using the switch statement over : In what circumstances would a programmer use if-then-else instead of if-then? Also, What is the advantage of using the switch statement over a series.
Identify two types of software vulnerabilities : Identify two types of software vulnerabilities present in insecure software applications. Describe the vulnerability and the types of attacks it encourages.
Create variables to store values : Using java create variables to store these values. Devise with good names for these variables. In addition to creating the variables, set the values as follows:
How many such strings have exactly five as : How many such strings have exactly five a's? How many such strings have three of each letter?

Reviews

Write a Review

JAVA Programming Questions & Answers

  Define characteristics of the input variables

List all of the input variables, including the state variables. HINT: Consider the state of the Queue like we did in our class example with state.

  Display the contents of the players array

Programming Assignment. Display the contents of the player's array, regardless of whether the template has been updated.

  Create a program to manage a student database

This programming project involves writing a program to manage a student database. The interface to the program should be a GUI.

  What is the efficiency of insertion sort

What is the efficiency of insertion sort - What is the base case for the recursive merge sort algorithm?

  Prepare a main method that tests all of your functions

A method that outputs the name and list of all patients - A method that resets the number of patients to 0 and the patientList to an empty list - Prepare a main method that tests (i.e, unit testing) all of your functions.

  Write, compile and run a standalone java application

Write, compile and run a standalone Java application that displays an output line on the console.

  Create a login and accounts page

For this assignment, you will build upon your prior assignment 2. Using the style and pages of your assignment 2, you need to create a login and accounts page.

  Method that reads a text file and returns a list of tokens

Write a method that reads in a text file and returns a list of the tokens (preferably alphanumeric) in that file. Write a method to print out frequency results.

  Communicating parties can encrypt

In an RSA cryptosystem, a public key infrastructure is implemented such that the communicating parties can encrypt, and be able to decrypt the ciphertext. Given p = 3 and q = 11 encrypt a message m =2, then decrypt the same message if the private ..

  Define method headers for computeaveragesales

Define method headers for computeAverageSales() and computeShipping Charges() according to the following requirements. Develop pseudocode for two new methods to be added to your product class

  Display the properties of an arraylist object

Display the properties of an ArrayList object. The assignment is documented as attached. In 9-3.docx, #4-6 is what I am trying to complete

  Subtract the immediate constant

Call a procedure at 5120, stacking the return address Subtract the immediate constant 16 from the stack pointer Compare the actual parameter to the immediate constant 4 Jump if equal to 5152

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd