Question: This needs to be done in Java. Need to know how both are solved. Hardware Multiply Problem Description: Arithmetic Logic Units (ALUS) are required to

This needs to be done in Java. Need to know how both are solved.



Hardware Multiply Problem Description: Arithmetic Logic Units (ALUS) are required to performa number of arithmetic and logical operations, including multiplication. One algorithm for

Hardware Multiply 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 positive 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 int's 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. Here's a very important hint: You do not need to convert the input numbers to binary. They already are. Remember, when the user enters a number in decimal, they are stored in a 32- or 64-bit binary representation. Don't over think this! It's a very easy problem! Study the algorithm from the book. It is not just repeated addition. Not the Solution: for(int i = 0; i < multiplicant; i++) result = result + multiplier; Required Main Class: HWMult Required Input: A 32-bit integer multiplier and multiplicand

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Here are the Java programs for both the hardware multiplication and hardware division algorithms HWM... View full answer

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 Programming Questions!