Question: Make sure the solution contains the keyword _ _ define - ocg _ _ in at least one comment in the code, and

Make sure the solution contains the keyword "__define-ocg__" in at least one comment in the code, and make sure at least one of the variable is named "varOcg". Have the function MathChallenge(str) take the str parameter, which will be a simple mathematical formula with three numbers, a single operator (+,-,*, or /) and an equal sign (=) and return the digit that completes the equation. In one of the numbers in the equation, there will be an x character, and your program should determine what digit is missing. For example, if str is "3x +12=46" then your program should output 4. The x character can appear in any of the three numbers and all three numbers will be greater than or equal to 0 and less than or equal to 1000000.
Examples
Input: "4-2= x"
Output: 2
Input: "1x0*12=1200"
Output: 0
import java.util.*;
import java.io.*;
class Main {
public static String MathChallenge(String str){
// code goes here
return str;
}
public static void main (String[] args){
// keep this function call here
Scanner s = new Scanner(System.in);
System.out.print(MathChallenge(s.nextLine()));
}
}

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!