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 program to produce a summary of amounts due

Create a program that will produce a summary of the amounts due for Pat's Auto Repair Shop. Display a splash screen first, then display the Job Information Form.

  Build a student record managing system application

Build a student record managing system application

  Definition of function quadratic receives double parameters

Write down definition of function named quadratic which receives 3 double parameters a , b , c . If value of a is 0 then function prints the message "no solution for a=0"

  Program to read list up to hundred addresses

efine a class called address_t with members for the four integers. Your program should read a list up to 100 addresses and nicknames terminated by a sentinel address of all zeros and nickname.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Computing first seven values of fibonacci number sequence

Write a program that uses a loop to compute the first seven values of the Fibonacci number sequence.

  Pseudocode to read in data file containing student names

Read in a data file containing student names, ID number, and gender into an array. Print the contents of each record using the array.

  Creating a software package for amazon

Suppose you are creating a software package for Amazon.com that needs users to enter their own passwords. Your software requires that users' passwords meet the following criteria:The password should be at least six characters long.

  Create class to calculate perimeter and area rectangle

Create class Rectangle. The class has attributes length and width, each of which defaults to 1. It has read-only properties that calculate the Perimeter and the Area of the rectangle.

  Write a program that uses the curve class hierarchy

Write a program that uses the curve class hierarchy. The program should define several different objects, output their area, circumference, etc. It should also use the printcurve function.

  Design logic that continuously prompt user for numeric value

Design the logic for a program that continuously prompts a user for a numeric value until the user enters 0. The application passes the value in turn to a method that squares the number

  Smallest and largest values in element floating-point array

Copy 11-elemts array source into first portion of 34-element array sourceCopy. Find out the smallest and largest values in 99-Element floating-point array data.

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