I am working on a java assignment for my cs 111 class and I keep getting an missing return statement error, and have tried to determine the error but cannot locate it. I am sure that I have the right set of curly braces. My code is shown below. If anyone can offer advice to correct the error I would greatly appreciate it.
import java.util.*;
import java.io.*;
//Declare a class
public class Assingment3{
//make the doMath method
static int doMath(char op,int numa, int numb){
switch (op)
{
case '+':
return numa + numb;
case '-':
return numa - numb;
case '*':
return numa * numb;
case '/':
return numa / numb;
}
}
//Make the exponent method
static int exponent(int a, int b){
int return_val = 1;
if (b < 0)
{
System.out.println("Error: Exponent Must Be >=0");
return_val = 1;
}
else if (b == 0)
{
return_val = 1;
}
else if (b == 1)
{
return_val = a;
}
else
{
return_val = a * exponent (a, b-1);
}
return (return_val);
}
//Declare main
public static void main(String[] args){
//Set up Scanner to take input from the user
Scanner sc = new Scanner(System.in);
//Declare the variables
int inta, intb, result0;
String op;
char charop;
//Ask the user to input an integer expression
System.out.println ("Enter a simple integer expression:");
//Assing values entered by the user
inta = sc.nextInt();
op = sc.next();
charop = op.charAt(0);
intb = sc.nextInt();
//Present the output to the user
System.out.print("This Program is Not Complete Yet");
}
}