Find Jobs
Hire Freelancers

Python Napier Calculator

$10-30 USD

Completed
Posted almost 9 years ago

$10-30 USD

Paid on delivery
This needs to be in Python. Problem statement For this program, you are to design and implement a calculator for positive integers that uses John Napier's location arithmetic (explained below). The user of your program will enter two numbers, using Napier's notation, and an arithmetic operator. You program is to translate these numerals into Hindu- Arabic decimal numbers, display them, perform desired operations, and finally print the result - in both abbreviated Napier's notation and in Hindu-Arabic decimal notation. The arithmetic operators that your program should recognize are +, -, *, and /. These operators are used to perform Python operations of integer addition, subtraction, multiplication, and division. The program is to be repeated as many times as the user wishes. You can not use import libraries. Input An input to your program will be interactive. Napier used letters to represent successive powers of 2, where a = 20, b = 21, c = 22, d = 23, ... z = 225. When converting to a decimal numeral you simply add the digits: abdgkl=20 +21 +23 +24 +26 +210 +211 =1+2+8+64+1024+2048=3147 His location numerals used sign-value notation, in which a number is simply the sum of its digits, where order does not matter, and digits can be repeated, e.g. abc = cba = bca abbc = acc = ad After each number or an operator is entered, you are to make sure that no illegal characters or arithmetic operators were entered. For numbers, an illegal character is anything that is not a letter. For operators, an illegal character is anything other than one of the four operator characters listed above. When an invalid input occurs, the program is not to crash or exit, but to ask the user for the given value again – until the valid values are entered. Output In addition to printing the decimal values of the two numbers entered by the user, you need to print the result of the operation in both notations. When printing in Napier's notation, make sure you do not repeat letters where a single letter would do, e.g. instead of abbc, you should print ad. In addition, if the result of your calculation is a 0, the equivalent string would be an empty string which we will not be able to see on the screen, so in such a case print a set of quotes, e.g. "". If the result of your calculations is a negative number, print the number with a minus sign in front, e.g. –abc. To represent a given decimal number as a location numeral, express it as a sum of powers of two and then replace each power of two by its corresponding digit (letter). For example, when converting from a decimal number: 87=1+2+4+16+64=20 +21 +22 +24 +26 =abceg You may find standard algorithms for converting from decimal to binary useful to achieve this purpose. To convert from a base-10 integer to its base-2 (binary) equivalent, the number is divided by two, and the remainder serves as the least-significant bit. The (integer) result is again divided by two, its remainder is the next least significant bit. This process repeats until the quotient becomes zero. Example: 13 / 2 = 6 R 1 6/2=3R0 3/2=1R1 1/2=0R1 So 13 in decimal is 1101 in binary which basically tells you to look at letters corresponding to where 1s occurred in the bit stream, which in this case means positions 0, 2, and 3 = acd Sample run Enter Napier's number: -ab2 Something is wrong. Try again. Enter Napier's number: abc The first number is: 7 Enter Napier's number: he lo Something is wrong. Try again. Enter Napier's number: hello The second number is 20,624 Enter the desired arithmetic operation: # Something is wrong. Try again. Enter the desired arithmetic operation: - The result is -20,617 or -adhmo Do you want to repeat the program? Enter y for yes, n for no:
Project ID: 7788103

About the project

6 proposals
Remote project
Active 9 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
Awarded to:
User Avatar
A proposal has not yet been provided
$25 USD in 1 day
5.0 (3 reviews)
1.6
1.6
6 freelancers are bidding on average $26 USD for this job
User Avatar
I teach algorithms and data structures using Java, python and c++. I can finish this project for you
$30 USD in 1 day
4.9 (2 reviews)
2.8
2.8
User Avatar
A proposal has not yet been provided
$15 USD in 5 days
0.0 (0 reviews)
0.0
0.0
User Avatar
Interesting project. I have prior experience with Python and love for algorithms. Please consider for the project. Can discuss more details .
$50 USD in 5 days
0.0 (0 reviews)
0.0
0.0
User Avatar
Hi! I am experienced Python developer and I can easily help you with this small problem. Task looks pretty simple and I can finish it within 24 hours.
$20 USD in 1 day
0.0 (0 reviews)
0.0
0.0

About the client

Flag of UNITED STATES
Lynnwood, United States
5.0
10
Payment method verified
Member since Feb 11, 2014

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.