Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

1. Your first task will be to come up with an appropriate data structure for representing numbers of arbitrary potential length in base 215. You will have to deal with large negative numbers also1. (Any negative number is to be stored in such a way that the most significant digit is a -1, but all lower order digits are positive. Note that you will need to make sure that you don't have a multidigit number with 0 as the high order digit. Also, you are required to make sure that the top two high order digits of any number store are not -1,32767. If you have trouble figuring out why, come see me...) You need to write a function that takes a given file that contains a number in base 10, reads it in, and stores it in your data structure in base 215.
2. Given a number that is represented in your data structure, you will need a function that prints it out in base 215 in such a way that its contents can be checked for correctness. Your function will need to print out the "digits" of the number, one digit after another, each separated by a comma with no white spaces in between, high-order "digit" of your number first.
3. You will write functions for both addition and subtraction of two num- bers encoded in your data structure. These functions should not be hard to write. Remember how you add and subtract numbers in base 10 and you should be able to figure out how to do it. Addition should automati- cally calculate the sum of memory locations 1 and 2 and store the answer in memory location 3 (erasing any other number that was previously in memory location 3). Subtraction should automatically calculate mem- ory location 1 minus memory location 2 and store the answer in memory location 3 (again, erasing any previous data).
4. You need to write a function that performs multiplication of two numbers in your data structure. Again, remember how you multiply numbers in base 10 and you should be fine. Multiplication should automatically cal- culate the product of memory locations 1 and 2 and store the answer in memory location 3 (erasing previous data).
5. Write a function that performs integer division. The function should take the large number in memory location 1 and divide it by the large number in memory location 2 disregarding any remainder. The result should be placed into memory location 3. This will probably be your most difficult function to write for this assignment. Remember how you do long division in base 10...
6. Write a function that performs the integer mod function. Given the pre- vious functions you have implemented already, this one should be a piece of cake. This function will find the result of taking the large number in memory location 1 modulo the large number is memory location 2, placing the result in memory location 3. (If location #2 has a negative number in it, then you will take the mod using the absolute value of that number.) The result of a "mod" operation will always be a nonnegative number less than absolute value of the large number in memory location 2.
7. Finally, you need to implement a function which will write out a given user-specified memory location to disk in base 10. That means that you have to convert the large number data structure back into base 10 digits before writing them back out to disk. The user will input the file name that the file is supposed to write to along with which memory location.
Your program should be menu driven and contain menu functions for each of the functions that you had to write above. Your code doesn't need to be superoptimized, but it does need to be good enough so that any given command takes at most one minute to execute. The menu should look as follows.
1. Read in a number from a file 2. Print out a large number to the screen 3. Add two large numbers 4. Subtract two large numbers 5. Multiply two large numbers 6. Integer divide two large numbers 7. Location 1 modulo location 2 8. Write to disk in base 10 9. Quit Choose your option: 1 File name: a.dat Memory location (number between 1 and 3): 1

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M91867412
  • Price:- $40

Priced at Now at $40, Verified Solution

Have any Question?


Related Questions in Computer Engineering

Question take screenshots of functions running in clisp

Question : Take screenshots of functions running in cLISP. Provide a description for each screenshot. 1. Create the function DecTree that will implement decision tree. Your function should accept input of decimal string ...

Answer as thorough as possiblecase 2 describe in detail

Answer as thorough as possible. Case 2: Describe in detail each of four risk factors of holding a domestic bond. Your summary should convince the reader that you fully understand each risk factor.

You were recently hired as a database administrator for

You were recently hired as a database administrator for CSU-Global Campus. During grade reporting, CSG-Global cannot afford to have any downtime. You have been asked to develop a plan for monitoring SQL Server databases. ...

Question suppose you are stranded on a desert island on

Question : Suppose you are stranded on a desert island on which queues are plentiful, but you need a stack. How can you implement a stack using two queues? What is the big-Oh running time of the stack operations?

Python programmingplease i would like some help in checking

Python programming Please I would like some help in checking if my source code for is susceptible to short-circuit evaluation.I don't need answers, I just need corrections. The source code is to check the integer parts o ...

Show proof of correctness and state and solve the

Show Proof of correctness and state, and solve the Recurrence using the Master Theorem. Let G = G(V, E) be an arbitrary, connected, undirected graph with vertex set V and edge set E. Assume that every edge in E represent ...

Question the three as of security are authentication

Question: The three A's of security are Authentication, Authorization, and Auditing. Write a 1-2 page paper in APA format describing these techniques and how they are used in your organization. What could be improved? Th ...

Searching algorithm - which to use for this problemthe

Searching Algorithm - Which to use for this problem? The original problem was: You get a job with a small e-commerce company. b) The customer base has grown to 8,000,000 customers. Jorge now insists that the sorting algo ...

System analysis and design1 describe the difference between

System Analysis and Design: 1) Describe the difference between behavioral and structural UML diagrams and provide an example UML diagram type for each and explain how the diagram selected is either behavioral or structur ...

Strings in cstrings manipulationwrite one main code with

Strings in C++ Strings manipulation Write one main code with the following functions. Toggle Write a function called toggle() that accepts a string, and an integer. The function checks whether the character at the positi ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As