Define stubs for the methods called by the below main().

Define stubs for the methods called by the below main(). Each
stub should print “FIXME: Finish methodName()” followed by a
newline, and should return -1. Example output: FIXME: Finish getUserNum()
FIXME: Finish getUserNum()
FIXME: Finish computeAvg()
Avg: -1
FOR JAVA PLEASE
import java.util.Scanner;

public class MthdStubsStatistics {

/* Your solution goes here */

public static void main() {
int userNum1 = 0;
int userNum2 = 0;
int avgResult = 0;

userNum1 = getUserNum();
userNum2 = getUserNum();

avgResult = computeAvg(userNum1, userNum2);

System.out.println(“Avg: ” + avgResult);

return;
}
}

code:
package mthdstubsstatistics;
import java.util.Scanner;
public class MthdStubsStatistics {
public static int getUserNum(){
System.out.println(“FIXME:
Finish getUserNum()”);
return -1;
}
public static int computeAvg(int userNum1,
int userNum2){
System.out.println(“FIXME:
Finish computeAvg()”);
return -1;
}
public static void main(String[] args) {
int userNum1 = 0;
int userNum2 = 0;
int avgResult = 0;
userNum1 = getUserNum();
userNum2 = getUserNum();
avgResult = computeAvg(userNum1,
userNum2);
System.out.println(“Avg: ” + avgResult);
return;
}
}
Solution package mthdstubsstatistics; import java.util.Scanner; public class MthdstubsStatistics public static int getUserNum ) System.out.println (“FIXME: Finish getUserNum)” return -1; public static int computeAvg (int userNum1, int user Num2)t System.out.println (“FIXME: Finish computeAvg )”); return -1; public static void main (String[] args)t int userNum10 int userNum2 0 int avgResult = 0; userNum1 getUserNum) userNum2getUserNum ); avgResult computeAvg (userNuml, userNum2) System.out.println(“Avg:”+ avgResult); return; Output run: FIXME: Finish getUserNum () FIXME: Finish getUserNum () FIXME: Finish computeAvg () Avg:1 BUILD SUCCESSFUL (total time: 0 seconds)
Define stubs for the methods called by the below main(). Each
stub should print FIXME: Finish methodName() followed by a
newline, and should return -1. Example output:
FIXME: Finish getUserNum()
FIXME: Finish getUserNum()
FIXME: Finish computeAvg()
Avg: -1

FOR JAVA PLEASE 


import java.util.Scanner;

public class MthdStubsStatistics {

/* Your solution goes here */

public static void main() {
int userNum1 = 0;
int userNum2 = 0;
int avgResult = 0;

userNum1 = getUserNum();
userNum2 = getUserNum();

avgResult = computeAvg(userNum1, userNum2);

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

return;
}
}

Leave a Comment