Question: JAVA program Problem Description: Arithmetic Logic Units (ALUs) are required to perform a number of arithmetic and logical operations, including multiplication. One algorithm for performing

JAVA program

Problem Description:

Arithmetic Logic Units (ALUs) are required to perform a number of arithmetic and logical operations, including multiplication. One algorithm for performing an integer multiplication of two 32-bit integers is shown in your book on pages 184 and 185 (Figures 3.3 and 3.4). Write a program in Java that implements this algorithm.

Your program should prompt for two 32-bit numbers and print the 64 bit answer. As a comparison, also display the result of a normal Java multiply.

Often when programming in Java we do not pay enough attention to the size of our integers, and just arbitrarily use ints for all of them. We want to be more careful with this solution. Use the proper size variable for each of: Multiplier, Multiplicand, and Product. You can refresh your memory of variable sizes in the chart below:

Type

Size, in bits

byte

8

short

16

int

32

long

64

Notes:

Do not create these classes in a package.

Turn in only your Java source files.

Required Main Class:

HWMult

Required Input:

A 32-bit integer multiplier and multiplicand

Required Output:

Your output should look something like the following example. It should include your name.

Hardware Multiply - your name 
Multiplier? 387637653 
Multiplicant? 366499587 
387637653 x 366499587 = 142069039730149311 
Java: 142069039730149311 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!