Sovi.AI - AI Math Tutor

Scan to solve math questions

QUESTION IMAGE

organize the lines of code to define stubs for the getusernum() and com…

Question

organize the lines of code to define stubs for the getusernum() and computeavg() methods. each stub should print fixme: finish followed by the method name, and should return -1.
click here for example
how to use this tool
unused
public static int computeavg(int num1, int num2) {
return -1;
system.out.println(\fixme: finish getusernum()\);
system.out.println(\fixme: finish computeavg()\);
public static int getusernum() {
}
return -1;
}
mthdstubsstatistics.java load default template...
import java.util.scanner;
public class mthdstubsstatistics {
public static void main(string args) {
int usernum1;
int usernum2;
int avgresult;
usernum1 = getusernum();
usernum2 = getusernum();
avgresult = computeavg(usernum1, usernum2);
system.out.println(\user values: \ + usernum1 + \,
system.out.println(\average user value: \ + avgresi
}

Explanation:

Step1: Define getUserNum() method

public static int getUserNum() {
    System.out.println("FIXME: Finish getUserNum()");
    return -1;
}

Step2: Define computeAvg() method

public static int computeAvg(int num1, int num2) {
    System.out.println("FIXME: Finish computeAvg()");
    return -1;
}

Answer:

The complete code with properly defined stubs for getUserNum() and computeAvg() methods is as follows:

import java.util.Scanner;

public class MthdStubsStatistics {
    public static int getUserNum() {
        System.out.println("FIXME: Finish getUserNum()");
        return -1;
    }

    public static int computeAvg(int num1, int num2) {
        System.out.println("FIXME: Finish computeAvg()");
        return -1;
    }

    public static void main(String[] args) {
        int userNum1;
        int userNum2;
        int avgResult;

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

        avgResult = computeAvg(userNum1, userNum2);

        System.out.println("User values: " + userNum1 + ", " + userNum2);
        System.out.println("Average user value: " + avgResult);
    }
}