Define stubs for the functions called by the below main(). Each stub should print "FIXME: Finish FunctionName()" followed by a newline, and should return -1. Example output: FIXME: Finish GetUserNum() FIXME: Finish GetUserNum() FIXME: Finish ComputeAvg() Avg: -1

Respuesta :

Answer:

A stub method or purely a stub in software development is a code part that accomplishes numerous other programming functionality. It can replica the prevailing code deeds like a process on an inaccessible machine-like method that is fairly recurrently known as mocks or for a while employed for a code that has not hitherto been industrialized.

Please crisscross the explanation for more particulars.

Explanation:

A method stub in this intellect is a method with no realistic substantial, i.e. it never conducts what it is envisioned to do. Your getUserNum() method must return an operator's unique ID, but then in its dwelling, you're placing a stub that just returns -1 on each and every plea.

Concluding the main method, you must describe these approaches:

N1=getUserNum();

N2=getUserNum();

avgResult = computeAvg(N1, N2);

Hereafter, label them. And beneath is in what way the overhead stub function must be like:

public static int getUserNum(){

System.out.println("FIXMR:Finish getUserNum()");

return -1;

And the complete package must look like:

import java.util.Scanner;

public class Main {

public static int getUserNum ()

{

System.out.println("FIXME: Finish getUserNum()");

return -1;

}

public static int computeAvg(int N1, int N2)

{

int avgResult = (N1 + N2)/2;

System.out.println("FIXME: Finish computeAvg()"); return -1;

}

public static void main(String[] args)

{

int N1 = 0;

int N2 = 0;

int avgResult = 0;

N1 = getUserNum(); N2 = getUserNum();

avgResult = computeAvg(N1, N2);

System.out.println("Avg: " + avgResult);

return;

}

}