(5/5)

Hire Me
(5/5)

Hire Me
(5/5)

Hire Me
(5/5)

Hire Me

# numerical approximations, or in cryptography with the computation of largeprime numbers, it is essential to handle numbers with ’infinite’ precision.

INSTRUCTIONS TO CANDIDATES

ECE 122: Introduction to Programming for ECE- Spring 2020

Description

In few applications in numerical approximations, or in cryptography with the computation of largeprime numbers, it is essential to handle numbers with ’infinite’ precision. In almost all programminglanguages, the standard native types such as int and float are limited in size. For example, an intvariable in Java, C, (etc.) has a maximum absolute value of 2,147,483,647=2311 (largest knownprime until 1855), and primes generated for cryptography purposes can easily be several hundreddigits. The situation is similar for floating point numbers (stored in double precision with ’only’16 digits digital accuracy). To overcome these limitations, a common approach is to implementa custom number class, that supports addition, subtraction, multiplication and division of bignumbers. These big numbers are commonly stored using lists (where each item of the list stores aparticular digit). For example the following integer:

i=123456789123456789123456789

can be written as:

ilist=[1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9]

In fact, Python already provides an arbitrary precision arithmetic for int. The list implementa-tion of the integer is implicit, as soon as the number becomes too big (greater than 2311), pythonswitches automatically its internal representation to a list (without you, seeing it). So the numbercan expand indefinitely. For example, you could easily computei**2with the number above andpython will return a bigger number (this is not the case with most other languages). Python doesnot provide this feature with floating numbers where the number of representative decimal digitsstays stuck at 16. To simplify a bit this project, however, we are not going to consider floating bignumbers but integer big numbers. It means that we are going to develop our own big number classfor integer regardless of the fact that it is redundant for Python.The project must include two files:

1.bigcalculator.py- This is the main code which is provided to you. It is thennot allowedto modify it.

2.BigNumber.py- This is a module that contains the class BigNumber to represent the bignumbers, and few instance methods that operate on big numbers. This is the file that youmust change, complete and submit. You are not allowed to change the names of the methods,but you can add any additional internal methods if needed.

Using this new BigNumber class, you will be able to consider arbitrary size addition, subtrac-tion, and multiplication. The class should easily be able to handle numbers that are hundreds ofdigits long. In order to implement the required mathematical operations, we will obviously needto traverse/scan and manipulate the list associated with an arbitrary size number. The project is then testing your algorithmic skill (basic mathematical algorithms). As a reminder, one ofthe main goal of this class is to learn how to use programming as a tool for solving Engineer-ing/Scientific/Mathematical problems (and not only programming for programming). As always,try to design solutions using paper and pencil first and work on a ’code skeleton’ (a.k.a. pseu-docode) before any attempts to program anything. When asking questions to TA, you must beable to show and discuss your pseudocode solution.

The project is designed to be incremental, you can then debug, test and run your code aftereach new task/option is implemented. However, they are few special (corner) cases to account foralong the way. It is not always essential to complete them in order to move to the next tasks, butthey would need to be completed for full credit.

Since the main program must stay unchanged, you will only need to submit your completedBigNumber.pyfile on Moodle. This project will be graded out of 100 points:

1. Your program should implement all basic functionality/Tasks and run correctly (100 points).

2. Overall programming style: program should have proper identification, and comments. (-5points if not)

How to Start

Although the fileBigNumber.pyis incomplete, the program is initially functional (like project1).It means that you should be able to run the main programbigcalculator.pywithout expectinga crash. You will then get the following:

This program asks the user to choose an operation. Depending on the operation selected, itwill ask the user to enter one or two numbers, and it will then output the result. The user canselect ’q’ to quit. We are going to detail all the tasks associated with the various operations thatmust be performed incrementally.

Note that to simplify the project, we will consider onlypositive numberas inputs.

If the user entersnone, you should get:

This option is just here to test your big number representation. The code will read a string,create an object of type BigNumber (which is mainly a list including all digits), and print this bignumber.

We note that the input String number may contain zeros on the left, random comas or randomspaces. when creating the list, you will have to somehow filtered the string.

When this option selected, the program should ask for 2 big numbers, print them and comparethem. It will also return some info.

How to proceed?

1. You need to complete the methodcompare. Hint: since both input numbers are consideredpositive, you could compare the length of the lists to get the smaller or greater flag correct.If the lists are the same size, you need to scan from left to right and compare digit by digit.

## Related Questions

##### . The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

CS 340 Milestone One Guidelines and Rubric  Overview: For this assignment, you will implement the fundamental operations of create, read, update,

##### . Develop a program to emulate a purchase transaction at a retail store. This  program will have two classes, a LineItem class and a Transaction class

Retail Transaction Programming Project  Project Requirements:  Develop a program to emulate a purchase transaction at a retail store. This

##### . The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

##### . Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip

##### . The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

CS 340 Final Project Guidelines and Rubric  Overview The final project will encompass developing a web service using a software stack and impleme

Get Free Quote!

430 Experts Online