Write a program for a calculator

Assignment Help Programming Languages
Reference no: EM13333090

Write a program for a Calculator that can do two operations, + and -. This calculator should be able to add or subtract two numbers of any size. You may use Recursion if you want. The following is the sequence of steps that your program should follow:

1. Ask user to enter the first number.

2. Your program should get this number from the user.

3. Ask user to enter the second number.

4. Your program should get this number from the user.

5. Ask user whether the user wants addition or subtraction. User will enter + or -.

6. Your program should add or subtract the two numbers depending on what user entered above.

7. Finally, your program should show the result in the output screen.

Now, in order to implement this calculator program, you need to remember the following:

1. Take the first number from the user and store that number in a linked list. Let's say the first linked list has head named ‘num1'.

2. Take the second number from the user and store it in another linked list. Let's say the second linked list has head named ‘num2'.

3. Remember that the user may enter a number of any size. Your program should keep on taking the number until user hits the Enter key. As soon as the user hits Enter key, your program should know that the user is done entering the first number. Now your program should repeat this process to take second number from the user.

4. If the user enters the following number: 45683450976535456 and hits Enter, it means your code should create the first linked list of 17 nodes because there are 17 digits in the abovementioned number. Similarly your program will create another linked list of n nodes where n is the number of digits in the second number.

5. Let's say, the user enters 351278 as the first number and 21 as the second number. So after taking both numbers from the user, this will be the situation:

1396_assign 1.png

6. Now if user entered +, then all you need to do is to add the above two linked list and create a third linked list containing the final answer. Print this linked list in the output screen.

552_assign 2.png

Reference no: EM13333090

Questions Cloud

The calcium hydride reacts with water to form hydrogen gas : Calcium hydride (CaH_2) reacts with water to form hydrogen gas. How many grams of CaH_2 are needed to generate 55.0 L of H_2 gas at a pressure of 0.995 atm and a temperature of 32 degrees Celsius
Software and marketing are currently out selling km solutio : Watch the KM Promo videos to get an idea of what software and marketing are currently out selling KM solutions
What is the profit-maximizing output for the monopolist : What is the profit-maximizing output for the monopolist? Calculate its profit.
Determine the pressure in the narrow section of the pipe : An incompressible fluid is flowing through a pipe with a constriction. The pipe is on an incline with an angle of 30.0 degrees. What is the pressure in the narrow section of the pipe
Write a program for a calculator : Write a program for a Calculator that can do two operations, + and -. This calculator should be able to add or subtract two numbers of any size. You may use Recursion if you want.
Development of assumptions and plans : Development of assumptions and plans about the factors influencing next year's budget in advance of the budget year starting and approval of the budget before the commencement of the budget year
Calculate book and market values of firms stockholder firm : Ez toy inc. lists fixed assets of $25 million on its balance sheet. The firm's fixed assets were recently appraised at $32 million. EZ toy inc's balance sheet also lists current assests at $10 million.
Obtain the magnitude of the induced current in the coil : The component of the external magnetic field along the central axis of a 125-turn coil of radius 29.0 cm decreases from 2.90 T to 0.400 T in 2.40 s. what is the magnitude of the induced current in the coil
What will be their wacc if they incerase debt as proposed : A company is trying to decide whether to revise its target capital structure. Currently, it targets 50% debt and 50% equity. However, it is considering changing the mix to 70% debt and 30% equity.

Reviews

Write a Review

Programming Languages Questions & Answers

  Explaining exception handling using program

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

  Write procedure list-records whihc returns list of records

Write a procedure called list-records which returns a list of all records by artist from a list of records containing several artists.

  Design pseudocode for application to enter order item

Design the pseudocode for an application that allows a user to enter an order item continuously until a sentinel value is entered.

  Create classes essential to create service quote

Create classes essential to create service quote. Write the application program which will use classes to create the objects and output the service quote.

  Projects for the falling letters game

Design and implement two projects for the Falling Letters game using C# and Windows Presentation Foundation (WPF) template in Visual Studio 2012 or newer.

  Design a website by using php and mysql to order pizza

Your task for this project is to design a website by using PHP and Mysqlto order pizza - A website with a complete catalog of pizzas with possible add-on options and customers should be able to prepare and customize an order as per their preference..

  Creating main function that opens the input file

Create a main function that opens the input file, reads each line, and based on first character in input line, calls the [A]dd function or [M]ultiply function.

  Program to return the array index having largest savings

Write down function also called from main module - this function will find out and return array index containing the largest savings.

  Create test application that creates objects of type book

Create a test application that creates several objects of type book class and adds each Book to an ArrayList. Your test application should then do the following.

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Write program to accept specific team criteria

Here is the initial list of functional requirements: The program should be able to: Accept specific team criteria, Accept specific player criteria,Match players to teams based on criteria specified.

  Write down program which permits to play tic tac toe game

Write down the program which permits 2 players to play tic tac toe game. Program should contain class tictactoe to implement tictactoe object.

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