Write a program to model a simple calculator

Assignment Help Programming Languages
Reference no: EM1361447

Q1) Write a program to model a simple calculator. Each data line should consist of the next operation to be performed from the list below and the right operand. Assume the left operand is the accumulator value (initial value of 0). You need a function scan_data with two output parameters that returns the operator and right operand scanned from a data line. You need a function do_next_op that performs the required operation. do_next_op has two input parameter (the operator and the operand) and one input/output parameter (the accumulator). The valid operations are:

+ add, - subtract, * multiply, / divide, ^ power (raise left operand to the power of right operand), q quit Your calculator should display the accumulator value after each operation. A sample run follows: + 5.0 results in 5.0 ^2 raises 5 to the power of 2 and returns 25 /2.0 divides 25 by 2 and returns 12.5

Reference no: EM1361447

Questions Cloud

Create a function that takes a one dimentional array : Create a function that takes a one dimentional array us a argument the function should return only these members from the array which are divisible by 4.
Specific pathology of any organ system : Disease Process: Create a scenario involving providing care for a patient with a specific pathology of any organ system.
Determine costs that change in direct proportion : A method of attributing expenses to products based on assigning costs of resources to activities and assigning costs of activities to products is known as Unit Based Costing.
Calculate the minimum stopping distance of the car : Find out the magnitude of the wind velocity. Find the direction of the wind velocity.If the wind velocity is 39 due south, in what direction should the pilot set her course to travel due west? Use the same airspeed of 213 .
Write a program to model a simple calculator : Write a program to model a simple calculator. Each data line should consist of the next operation to be performed from the list below and the right operand.
The costs of maintaining current assets : The costs of maintaining current assets, including the opportunity cost of capital is known as, Expenses should be recorded in the period in which they are used up.
Program to calculate area of two-dimensional shape : Implement the Shape hierarchy shown in following figure. Each TwoDimensionalShape should contain method getArea to calculate the area of the two-dimensional shape.
Explain how does the price of fertilizer compare : Explain how does the price of fertilizer compare to the average total cost, the average variable cost, and the marginal cost of producing fertilizer.
Find the acceleration of the bucket : suppose that the springs have somehow not yet compressed to their maximum amount. How much are the springs compressed.

Reviews

Write a Review

Programming Languages Questions & Answers

  Create a simple shell

Create a simple shell. Basically your shell should read the line from standard input, parse the line with command and arguments, and operate the command with arguments.

  Explaining exception handling using program

Use exception handling appropriately. Use comments to illustrate the various concepts applied / utilized in the solution.

  Create nested menus interface for a check-in hotel

Create a nested menus interface for a check-in and check-out hotel reservation system that can be used internationally. Use numbers to select a menu item.

  Find largest number in array

Find the largest number in the array and output the result. use a subprogram to input the numbers, a function to use the largest number.

  Program to prompts user for integer and print prime number

Give a program which will compile in VS 2010. Write a program to prompts user for integer and then prints out all prime numbers up to that integer.

  Approach for building site in-house with existing staff

Web site Consider your options for building the site in-house with existing staff, or outsourcing the entire operation. Decide which strategy you believe is in your company's best interest and create a brief presentation outlining your position.

  Design program that asks user to enter budgeted amount

"Design a program that asks the user to enter the amount that he or she has budgeted for a month. (For example: $2,000.00)

  Create a project in xcode

Create a new project in XCode using the Mac OS X/Command Line Tool template

  Program using ten radio buttons to show five states

It is program using 10 Radio Buttons to show 5 States and 5 Capitals to user's interface. Also, there is text box to print "Correct" and "Incorrect" when Sate and the Capital is a correct match.

  Explain the use of xml dom

When the XMLHttpRequest object receives XML data, it parses and stores the data as an XML DOM object in the responseXML property. Why does the XML DOM used in the above example?

  Design a program using structured pseudocode

Design a program using structured pseudocode as demonstrated in the lectures and, ensuring all variables are declared, prompt the user for the appropriate input and display a meaningful output message.

  Evaluate the fibonacci series

Write a program to evaluate the first 20 numbers of Fibonacci series.

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