If multiplication is iterative addition, integer division must be a form of iter
ID: 3692102 • Letter: I
Question
If multiplication is iterative addition, integer division must be a form of iterative subtraction. How would we know when to terminate the loop? Or put more accurately, what is the "end state" of our loop? Output from the program, assuming the programmer placed 55 and 4 in the Input buffer should be:55 / 4 = 13 55 % 4 = 3
Process: 1.Take 2 integer values from the Input buffer. Assume the second value is the divisor. 2.Iteratively divide until the dividend is...?. 3.The program should display both the quotient and the remainder
Before you write the program in pep/8 assembly language, write it in Java and test the Java version to insure it works properly and you have a sense of how to implement it in the Pep/8 environment. Save the Java program as you will submit as part of the documentation. Develop the Pep/8 program as directed above. Save the Assembly Listing for submission with other documents. Develop a test plan (a simple text file will be fine). If multiplication is iterative addition, integer division must be a form of iterative subtraction. How would we know when to terminate the loop? Or put more accurately, what is the "end state" of our loop? Output from the program, assuming the programmer placed 55 and 4 in the Input buffer should be:
55 / 4 = 13 55 % 4 = 3
Process: 1.Take 2 integer values from the Input buffer. Assume the second value is the divisor. 2.Iteratively divide until the dividend is...?. 3.The program should display both the quotient and the remainder
Before you write the program in pep/8 assembly language, write it in Java and test the Java version to insure it works properly and you have a sense of how to implement it in the Pep/8 environment. Save the Java program as you will submit as part of the documentation. Develop the Pep/8 program as directed above. Save the Assembly Listing for submission with other documents. Develop a test plan (a simple text file will be fine). If multiplication is iterative addition, integer division must be a form of iterative subtraction. How would we know when to terminate the loop? Or put more accurately, what is the "end state" of our loop? Output from the program, assuming the programmer placed 55 and 4 in the Input buffer should be:
55 / 4 = 13 55 % 4 = 3
Process: 1.Take 2 integer values from the Input buffer. Assume the second value is the divisor. 2.Iteratively divide until the dividend is...?. 3.The program should display both the quotient and the remainder
Before you write the program in pep/8 assembly language, write it in Java and test the Java version to insure it works properly and you have a sense of how to implement it in the Pep/8 environment. Save the Java program as you will submit as part of the documentation. Develop the Pep/8 program as directed above. Save the Assembly Listing for submission with other documents. Develop a test plan (a simple text file will be fine).
Explanation / Answer
sample java code-
import java.util.Scanner;
class division{
public static void main(String arg[]){
float num1, num2 , rem;
double ans;
Scanner data = new Scanner(System.in);
// Reading 1st number
System.out.println("Enter 1st number");
num1 = data.nextInt();
//Reading 1st number
System.out.println("Enter 2nd number");
num2 = data.nextInt();
// checking divisor nonzero number
if(num2!=0)
{
// Finding Quotient
ans=num1/num2;
//Displaying Quotient
System.out.println("Quotient:"+ans);
// Finding Remainder
rem=num1%num2;
//Displaying Remainder
System.out.println("Remainder:"+rem);
}
else
System.out.println("Divisor should be nonzero number");
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.