Question: Can you please help me fix my code * You need to implement this * This function takes two int parameters, and a PrintStream, and

Can you please help me fix my code

* You need to implement this

* This function takes two int parameters, and a PrintStream, and prints (to the given PrintStream) their sum, difference, product, quotient and remainder.

* Preferably, print a message before it, like "The sum of 3 and 5 is 8"

* @param number1

* @param number2

*/

// notice this is void, so you call it like: printAllOperatiions(1,2,System.out)

public static void printAllOperations(int number1, int number2, PrintStream out)

{

// TODO - you need to implement this

sum = number1 + number2;

product = number1 * number2;

difference = number1 - number2;

quotient = number1 / number2;

remainder= number1 % number2;

System.out.println("The sum of "+number1+" and "+number2+" is "+sum);

printAllOperations(1,2,System.out);

System.out.print("The difference of "+number1+" and "+number2+" is " +difference);

printAllOperations(10,5,System.out);

System.out.print("The product of "+number1+" and "+number2+" is " +product);

printAllOperations(9,9,System.out);

System.out.print("The quotient of "+number1+" and "+number2+" is " +quotient);

printAllOperations(12,12,System.out);

System.out.print("The remiander of "+number1+" and "+number2+" is " +remainder);

printAllOperations(5,10,System.out);

}

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!