Need help making sum, difference, product, average in java using eclispe

Posted on 2010-01-08
Last Modified: 2013-11-23
hello Need help making sum, difference, product, average in java using eclispe i want to make this work in my program i only need two integers and have it display it sum, difference, product, and average how do you build it to do that.
Question by:seanf85
    LVL 2

    Accepted Solution

    If you just want to use two integers and not an array you just do the mathematical calculations on your integers:
    sum = integerOne + integerTwo;
    difference = integerOne - integerTwo;
    product = integerOne * integerTwo;
    average = (integerOne + integerTwo) / 2;

    Or do you want to put an array with integer values into a function that calculates the sum, difference, product and average?

    Author Comment

    what is the code for the array with integer values into a fuction that calculates the sum, difference, product and averge iam kinda of new to java my main problem iam getting these codes errors with the JOption is this due to the program not finding the right path also just want to ask how would i start this program out with the code you gave me. can you please me me example like the class main_class {
     java.lang.NoClassDefFoundError: my_kidprogram_Fernandez
    Caused by: java.lang.ClassNotFoundException: my_kidprogram_Fernandez
    at$ Source)
    at Method)
    at Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    Exception in thread "main"

    Author Closing Comment

    thanks for the help it worked

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Join & Write a Comment

    Suggested Solutions

    This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
    When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
    Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
    Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now