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

  Write a haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

These 14 questions covers java class, Array, link list , generic class.

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

  Write a prolog program using swi proglog

Write a Prolog program using swi proglog

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Create a application using the mvc architecture

create a application using the MVC architecture. No scripting elements are allowed in JSP pages.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Writing a class

Build a class for a type called Fraction

  Design a program that assigns seats on an airplane

Write a program that allows an instructor to keep a grade book and also design and implement a program that assigns seats on an airplane.

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