So the question is a 2 parter. I believe I have the part a completed right, but not 100% where to add in the second part. The first question is as follows:
A. Create an application named Numbers whose main() method hold two integer
variables. Assign values to the variables. Pass both variables to methods named
sum() and difference(). Create the methods sum() and difference(); they compute the sum of and difference between the values of two arguments, respectively. Each method should perform
the appropriate computation and display the results.
My answer is:
start
Declarations
num number1
num number2
input number1,number2
sum(number1,number2)
difference(number1,number2)
stop
void sum(num n1,num n2)
Declarations
num result
result=n1+n2
output "The sums of",n1, "and",n2, "is", result
return
void difference(num n1,num n2)
Declarations
num result
result=n1-n2
output "The difference of",n1, "and",n2, "is", result
return
The question for b is:
B. Add a method named product() to the Numbers class. The product() method should compute the multiplication product of two integers, but not display the answer. Instead, it should return the answer to the calling method, which displays the answer.
The instructor suggested that a case structure may help.