Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Mathematical functions map naturally to program functions and modules often are used to group such functions for reuse. In the Bukiyip* language, coconuts, days and

Mathematical functions map naturally to program functions and modules often are used to group such functions for reuse.

In the Bukiyip* language, coconuts, days and fish are counted in base 3. Numbers use only the digits 0-2, such that instead of "tens" and "hundreds", the second and third digits represents multiples of 3 and 9 respectively.

(Reference: http://mentalfloss.com/article/31879/12-mind-blowing-number-systems-otherlanguages)

Write a Python module called 'bukiyip.py' with the following functions for simple Bukiyip arithmetic, assuming that all values have at most 3 digits.

a) bukiyip_to_decimal (a)

Convert a Bukiyip number to decimal.

b) decimal_to_bukiyip (a)

Convert a decimal number to Bukiyip.

c) bukiyip_add (a, b)

Add two Bukiyip numbers.

d) bukiyip_multiply(a, b)

Multiply two Bukiyip numbers.

Sample I/O:

**** Bukiyip test program ****

Available commands:

d : convert given decimal number to base-3.

b : convert given base-3 number to decimal.

a : add the given base-3 numbers.

m : multiply the given base-3 numbers.

q : quit

Enter a command:

d 12

110

Enter a command:

b 20

6

Enter a command:

a 12 11

100

Enter a command:

m 12 11

202

Enter a command:

q

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Database Programming

Authors: Chris Fehily

1st Edition

1937842312, 978-1937842314

More Books

Students also viewed these Databases questions

Question

Why is the System Build Process an iterative process?

Answered: 1 week ago