Question: Complete the following method, which compares two parameters and returns 1,0 or 1 i the first parameter is less than, equal to or greater than

 Complete the following method, which compares two parameters and returns 1,0

Complete the following method, which compares two parameters and returns 1,0 or 1 i the first parameter is less than, equal to or greater than the second parameter. Note answers are case sensitive. public int compare (int a, int b) result: 1/ declare variable of appropriate type. The variable will get its value then be returned. if (acbi t -: assignment -1 to which variable? else (a b) /I when the two parameters have same value, assign 0 to variable to be returned else t 1I a must be great than b in this case result-1 result: 1/one of the branching keywords

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!