Results 1 to 3 of 3
  1. #1
    deeznatez is offline Member
    Join Date
    Oct 2012
    Rep Power

    Default Why wont this compile??

    Please help. Very frustrated. Can someone please help and tell me why this will not compile???

    Thanks in advance

    /*Program name:
    *Date: 10/04/2012
    *Time Spent: 30 min
    *Program Purpose: Create a class that has methods to
    *perform each of the arithmetic operations on two
    *numbers.In main, prompt the user for the input of two
    *numbers. After storing the values call each of the four
    *methods that perform simple arithmetic operations.
    *Each method should accept two numbers as formal parameters.
    *The addition method should add the two numbers together
    *and display the sum with a descriptive statement. The return
    *type will be void. The subtraction method should subtract
    *the smaller from the larger and display the difference.
    *The multiplication method should multiply the two numbers
    *together and return the product to be displayed in main. The division method
    *should check for division by zero and if the second number
    *is zero return a string error message otherwise the method
    *should return a String that reports the quotient and modulus
    *along with descriptive labels. The string, error or report,
    *will be displayed in main.*/

    import java.util.*;

    public class LetsDoMathMethods

    private int iNumber1;
    private int iNumber2;

    public static void main (String[] args);

    int iNumber1;
    int iNumber2;
    int iSum;
    int iDiff;
    int iProduct;
    int iDivision;
    int iModulus;

    Scanner inputNum = new Scanner(;

    System.out.println("Please enter an intenger: ");
    iNumber1 = inputNum.nextInt();
    System.out.println("Please enter another integer: ");
    iNumber2 = inputNum.nextInt();

    LetsDoMathMethods myMathOp = new LetsDoMathMethods();

    myMathOp.determineSum(int totalSum);
    myMathOp.determineDifference(int totalDifference);
    myMathOp.determineProduct(int productProduct);
    myMathOp.determineDivisionMod(String strReport1);

    public LetsDoMathMethods()


    public void determineSum(int iNum1, int iNum2)
    int totalSum;

    totalSum = iNum1 + iNum2;
    System.out.printf("\nThe total of the two numbers you entered is %d\n",

    public void determineDifference(int iNum3, int iNum4)
    int totalDifference;

    int biggestNum = (Math.max(iNum3, iNum4));
    int smallestNum = (Math.min(iNum3, iNum4));

    totalDifference = biggestNum - smallestNum;

    System.out.println("The difference between " + biggestNum
    + " and " + smallestNum + " equals: " + totalDifference);


    public int determineProduct(int iNum5, int iNum6)
    int productTotal;

    productTotal = iNum5 * iNum6;

    return productTotal;

    public String determineDivisionMod(int iNum7, int iNum8)
    int totalQuotient;
    int totalModulus;

    totalQuotient = iNum7 / iNum8;
    totalModulus = iNum7 % iNum8;

    String strReport1 = "The quotient is: " + totalQuotient + " and the modulus is: " + totalModulus + ".";

    if (iNum8 == 0)
    System.out.println("I'm sorry but that data is invalid.");

    return strReport1;


  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Madgaon, Goa, India
    Rep Power

    Default Re: Why wont this compile??

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    noctarius is offline Member
    Join Date
    Jun 2012
    Remscheid, Germany
    Rep Power

    Default Re: Why wont this compile??

    The compiler told you why it won't compile.

Similar Threads

  1. My NetBeans wont run/compile my code!
    By Bill Nye in forum NetBeans
    Replies: 2
    Last Post: 05-04-2012, 08:09 PM
  2. Able to compile OK, But wont run..Help
    By subiedude101 in forum New To Java
    Replies: 2
    Last Post: 02-20-2011, 09:37 PM
  3. This one wont compile either.. any tips?
    By Student101 in forum New To Java
    Replies: 9
    Last Post: 11-18-2010, 06:49 AM
  4. Why wont this compile?
    By Student101 in forum New To Java
    Replies: 8
    Last Post: 11-18-2010, 06:33 AM
  5. why wont it compile
    By bje98f in forum Advanced Java
    Replies: 1
    Last Post: 04-23-2009, 11:55 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts