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

  Formula to compute number of address bus conductors

If an address bus needs to be able to address 8-devices, how many conductors will be needed? What if each of those devices also requires to be able to talk back to the I/O control device?

  Portfolio website containing thumbnail imagery

Explain in general terms what you think the role of good design is. Next, recognize 3-characteristics of an effective gallery website. Then find an example of a portfolio website containing thumbnail imagery.

  Order statistic tree to count number of inversions in array

Demonstrate how to use an order-statistic tree to count the number of inversions in an array of size n in time O(n lg n).

  Online vs. face-to-face classes

Communication A significant distinction between online and face-to-face classes lies in the area of communication.

  Describe purpose of queue in breadth-first traversal

Describe the purpose of queue in breadth-first traversal? Assume you had function call displayAtDepthN, which when given tree and depth would display only nodes at that depth.

  Data structures used to organize typical file cabinet

Recognize at least two data structures which are used to organize typical file cabinet. Why do you feel it is essential to emulate these types of data structures in computer program?

  Linear-time algorithm for computing the strong component

On the basis of a linear-time algorithm for computing the strong component containing a given vertex v, describe a simple quadratic-time algorithm for computing the strong components of a digraph.

  Why internet need http

Discuss why does the Internet need HTTP, TCP, IP and DNS? Explain why is not the Internet Protocol enough to do the job? Please reply to these specific points of confusion.

  Write algorithm to create job applicant report

Write the algorithm to create job applicant report. Input consists of a series of records that contain the Social Security number or equivalent, last name, first name, middle initial.

  Algorithm to find maximum sum of contiguous sublist

Using dynamic programming, write an algorithm to find the maximum sum of contiguous sublist of a given list of n real values.

  Algorithm on dynamic programming-minimize amount of walking

Our goal is to plan this trip so that we minimize the maximum amount of walking done in a single day. Your algorithm should be based on dynamic programming and run efficiently.

  Algorithm to take input m constraints over n variables

For instance, the constraints x1 = x2, x2 = x3, x3 = x4, and x1 6= x4 cannot be satis fied. Give an efficient algorithm that takes as input m constraints over n variables and decides whether the constraints can be satis fied.

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