you will be implementing the so-called “Russian Peasant” or “Ancient Egyptian” method for multiplication. It looks a little odd, but just think of it as an algorithm, a recipe for doing multiplication...

1 answer below »

you will be implementing the so-called “Russian Peasant” or “Ancient Egyptian” method for multiplication. It looks a little odd, but just think of it as an algorithm, a recipe for doing multiplication in a way other than what you learned in grade school. The algorithm is as follows: If A and B are the 2 integers (only integers) to be multiplied, we repeatedly multiply A by 2 and divide B by 2, until B cannot be divided any further, that is, until its value becomes 0 (remember, this is integer division). During each step, whenever B is an odd number, we add the corresponding A value to the product we are generating. In the end, the sum of the A values that had corresponding odd B values is the product. Get it? Here is an example: If the two integers to be multiplied are 34 and 19, the operations would be: Sum up all the A values that had odd B values and you get: 34+68+544 = 646 => Final product. You are asked to write a program to find the product of two integers using the Russian Peasant method. Your program should show a shell-based menu with at least the following options: input two numbers, perform the calculation, print (in the screen) the help table above, and an exit option. This menu should look like to the one shown in the case study given as an example. Also, the menu should allow repeatedly ask whether the user wants to find another product. Problem process are allocated as follows: • Business Rules: o RephrasingtheproblemathandusingYOUROWNwords o Describinginputsandoutputs • Develop a “Hand-Written” Solution: You must first write down the step-by-step calculations manually before attempting any coding. This will become your algorithm. • Flowchart: Following previous step, a flowchart will be required to be able to write up your pseudocode. • Pseudo Code: Following previous step, a pseudo code will be required to be able to write up your Python module. • Python Module: once you complete your pseudo code, start writing your solution using a Python module.
Answered 4 days AfterSep 16, 2022

Answer To: you will be implementing the so-called “Russian Peasant” or “Ancient Egyptian” method for...

Kshitij answered on Sep 21 2022
59 Votes
CamScanner 09-20-2022 17.30
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here