Results 1 to 4 of 4
  1. #1
    insong04 is offline Member
    Join Date
    Oct 2014
    Posts
    2
    Rep Power
    0

    Default Test Arithmetic java programming error

    Hi
    I have written this program but I am seeing error when I compile this program ( javac TestArithmetic.java).
    1)TestArithmetic.java:26 cannot find symbol
    2)symbol: class Arithmetic
    3)location: class TestArithmetic
    4) Arithmetic ar = new Arithmetic(x1,x2,x3);

    1)TestArithmetic.java:26 cannot find symbol
    2)symbol: class Arithmetic
    3)location: class TestArithmetic
    4) Arithmetic ar = new Arithmetic(x1,x2,x3);


    2 errors. Can someone help me on this. Thx


    import java.util.*;

    class TestArithmetic {

    public static void main (String[] args){

    float number;
    Scanner console= new Scanner (System.in);

    System.out.println("Enter first number");
    int x1 = console.nextInt();
    System.out.println("Enter second number");
    int x2 = console.nextInt();
    System.out.println("Enter third number");
    int x3 = console.nextInt();


    Arithmetic ar = new Arithmetic(x1, x2, x3);

    int answer1=ar.sum(x1,x2);
    int answer2=ar.sum(x1,x2,x3);
    int answer3=ar.substract(x1,x2);
    double answer4=ar.divide(x1,x2);
    int answer5=ar.modulas(x2,x3);
    int answer6=ar.multiply(x2, x3);
    boolean evenNumber1= ar.isEvenNumber(x2);
    boolean evenNumber2= ar.isEvenNumber(x3);



    System.out.println("Sum of x1 and x2 is "+answer1);
    System.out.println("Sum of x1, x2, x3 is "+answer2);
    System.out.println("Subtraction of x1 and x2 is "+answer3);
    System.out.println("Division of x1 and x2 is "+answer4);
    System.out.println("Modulas division of x2 and x3 is "+answer5);
    System.out.println("Multiplication of x2 and x3 is "+answer6);
    if (evenNumber1)
    System.out.println("x2 is an even number");
    else
    System.out.println("x2 is an odd number");

    if (evenNumber2)
    System.out.println("x3 is an even number");
    else
    System.out.println("x3 is an odd number");


    }
    }

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

    Default Re: Test Arithmetic java programming error

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

  3. #3
    Ronin is offline Senior Member
    Join Date
    Oct 2010
    Posts
    393
    Rep Power
    9

    Default Re: Test Arithmetic java programming error

    Hi insong04, welcome.

    Firstly, please edit your code using th [code][/code] tags as shown in the link provided by Darryl. It makes reading code so much easier.
    The code above shows just the main method which is fine. Your problem lies in code you have not shown.
    These errors state that symbol has been used in the Arithmetic class and location has been used in the TestAritmetic classes, neither of which have been declared.

    Regards.

  4. #4
    insong04 is offline Member
    Join Date
    Oct 2014
    Posts
    2
    Rep Power
    0

    Default Re: Test Arithmetic java programming error

    Hi
    I can't open this web due to some security issue. Can you share me how to edit the code that you mentioned by Darryl? Thx

    BB Code List - Java Programming Forum - Learn Java Programming

Similar Threads

  1. NetPay java programming error-Need help
    By thessler1 in forum New To Java
    Replies: 15
    Last Post: 06-21-2012, 12:21 AM
  2. Replies: 3
    Last Post: 11-16-2011, 10:37 AM
  3. Java Arithmetic Program. PLEASE HELP!
    By Ahdood in forum New To Java
    Replies: 9
    Last Post: 10-31-2011, 09:15 AM
  4. Polynomial Arithmetic Java
    By thisisIT in forum New To Java
    Replies: 3
    Last Post: 03-09-2010, 05:33 PM
  5. Replies: 0
    Last Post: 04-05-2008, 12:38 AM

Posting Permissions

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