Develop a solution for the problem and mention algorithms

Assignment Help Data Structure & Algorithms
Reference no: EM13313351

Objectives:

To gain experience with stacks.

Documentation:
1. Explain the purpose of the program as detail as possible
2. Develop a solution for the problem and mention algorithms to be used
3. List data structures to be used in solution.
4. Give a description of how to use the program and expected input/output
5. Explain the purpose of each class you develop in the program.

Programming:
1. For each method, give the pre and post conditions and invariant, if any
2. Program execution according to the requirements given
3. Naming of program as required
4. Print out of source code

Description of Program

You are to write a program name calc.java that evaluates an infix expression entered by the user. The expression may contain the following tokens:
(1) Integer constants (a series of decimal digits).
(2) x (representing a value to be supplied later).
(4) Binary operators (+, -, *, / and %).
(5) Parentheses

Spaces between tokens are allowed but not required. The program will convert the (user input) infix expression to postfix (RPN) form and display the converted expression on the screen.

The following example illustrates the behavior of the program (user input is in bold and red):

Porgram output is in bold and green.

Enter infix expression: (7 + x) * (8 - 2) / 4 + (x + 2)
Converted expression: 7 x + 8 2 - * 4 / x 2 + +
Enter a value for x: 5
The result is: 25

Enter a value for x: 8
The result is: 36

Enter a value for x: 3
The result is: 20

Enter a value for x: q ------>Any value that is not an integer - the program terminates

When solving the postfix expression, you must prompt the user for an input value for x, solve the expression and return a result. You must use an operand stack to process the postfix expression.


Attachment:- Java-Stacks.docx

Reference no: EM13313351

Questions Cloud

Universal ethical egoism is inconsistent or incoherent : What do you think of the argument that universal ethical egoism is inconsistent or incoherent? Do you perceive an internal contradiction in the idea of “group self-interest” in contrast to individual self-interest? Provide an example that helps expla..
Explain saturated calomel electrode : Saturated Calomel Electrode || Titration Solution | Ag (s) Calomel Electrode: E=0.241V For Ag+ + e- ---> Ag(s), E0 = 0.79993 V. AgI is Ksp = 8.3 × 10-17. What it the volts at equivalence point when Ve=30.00mL
Determine the electric field at the electron : Type your question hereA uniform line of charge that is 5.00cm long has a total charge of 6.00uC. What is the electric field (given in magnitude and direction) at the electron
Find length and width of square basin for virus disinfection : Find the length and width of a square basin for virus disinfection of a flow of 6 MGD. You may assume a depth of 5 ft, a C(dot)t product of 10 (mg/L) (dot)min for 1.5-log removal, and a target free chlorine residual of 0.6 mg/L.
Develop a solution for the problem and mention algorithms : Spaces between tokens are allowed but not required. The program will convert the (user input) infix expression to postfix (RPN) form and display the converted expression on the screen.
Find probability that vehicle pulling out will get accident : The driver of the vehicle does not look for oncoming traffic. Road conditions and vehicle speeds on the highway are such that it takes 1.5 seconds for an oncoming vehicle to stop once breaks are applied.
Compute the amount naoh that is acetic acid : Calculate the amount (in mL) of a 1.520M NaOH that is required to add the following acetic acid solutions to prepare a buffer with the corresponding pH: pKa of acetic acid = 4.74
With what speed is the kereru travelling after the collision : a kereru new zealand wood pigeon travelling at 1.5 m/s due west has an elastic collision with an airbus a380 aeroplane. with what speed is the kereru travelling after the collision?
What is product positioning : What is product positioning? Product repositioning? Why and when would Rollerblade need to reposition?

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Implement an open hash table

In this programming assignment you will implement an open hash table and compare the performance of four hash functions using various prime table sizes.

  Use a search tree to find the solution

Explain how will use a search tree to find the solution.

  How to access virtualised applications through unicore

How to access virtualised applications through UNICORE

  Recursive tree algorithms

Write a recursive function to determine if a binary tree is a binary search tree.

  Determine the mean salary as well as the number of salaries

Determine the mean salary as well as the number of salaries.

  Currency conversion development

Currency Conversion Development

  Cloud computing assignment

WSDL service that receives a request for a stock market quote and returns the quote

  Design a gui and implement tic tac toe game in java

Design a GUI and implement Tic Tac Toe game in java

  Recursive implementation of euclids algorithm

Write a recursive implementation of Euclid's algorithm for finding the greatest common divisor (GCD) of two integers

  Data structures for a single algorithm

Data structures for a single algorithm

  Write the selection sort algorithm

Write the selection sort algorithm

  Design of sample and hold amplifiers for 100 msps by using n

The report is divided into four main parts. The introduction about sample, hold amplifier and design, bootstrap switch design followed by simulation results.

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