Results 1 to 10 of 10
Like Tree1Likes
  • 1 Post By PhHein

Thread: [Java Eclipse] About this problem

  1. #1
    Aries. is offline Member
    Join Date
    Jan 2013
    Posts
    22
    Rep Power
    0

    Default [Java Eclipse] About this problem

    Sample output :

    Enter first number : 2
    Enter second number : 3
    Answer is : 8

    // This is the process how we get the 8 = 2 * 2 * 2

    I'm having a problem with this because I have no idea when using the loop. Everytime I try it always "Error" .

    I'm so thankful if you will help me guys.

  2. #2
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,429
    Rep Power
    7

    Default Re: [Java Eclipse] About this problem

    Post your compilable code and the complete stack trace.
    DarrylBurke likes this.
    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

  3. #3
    Aries. is offline Member
    Join Date
    Jan 2013
    Posts
    22
    Rep Power
    0

    Default Re: [Java Eclipse] About this problem

    Quote Originally Posted by PhHein View Post
    Post your compilable code and the complete stack trace.

    Im having a problem with the formula or how to derived it( base to exponent ). Le me give you an example like additions.

    import java.util.Scanner;
    public class Addition {


    public static void main(String[] args) {
    Scanner a = new Scanner (System.in) ;
    System.out.print("Enter a number: ");
    int number1 = a.nextInt();
    System.out.print("Enter a number: ");
    int number2 = a.nextInt();
    int sum = (number1 + number2) ;
    System.out.println("The sum of " + number1 + " and " +
    number2 + " is " + sum);
    }

    }
    So in the console,
    I can type this

    Console:
    Enter a number: 2
    Enter a number: 3
    The sum of 2 and 3 is 5


    Back to my problem , I;m having a hard time about the exponent thingy, someone says it need loop for re-multiplying the 2nd enter the number to make it as a exponent and the base will multiply depends how many on exponent. :-(

  4. #4
    foulkelore is offline Member
    Join Date
    Dec 2012
    Location
    Des Moines, IA
    Posts
    35
    Rep Power
    0

    Default Re: [Java Eclipse] About this problem

    Here is link to the JAVA for statement tutorial. Give it a try and let us know if you have any questions. Also in the future you might want to learn how to use the code tags.

  5. #5
    Aries. is offline Member
    Join Date
    Jan 2013
    Posts
    22
    Rep Power
    0

    Default Re: [Java Eclipse] About this problem

    Quote Originally Posted by foulkelore View Post
    Here is link to the JAVA for statement tutorial. Give it a try and let us know if you have any questions. Also in the future you might want to learn how to use the code tags.
    thanks for the reply,

    I'm still working on it, but its the same I cant get it. grrr.

    Any pro there please?

  6. #6
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,429
    Rep Power
    7

    Default Re: [Java Eclipse] About this problem

    Quote Originally Posted by Aries. View Post
    Any pro there please?
    Loads of pros. Where is your code? What doesn't work? Where ist the stack trace?
    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

  7. #7
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,776
    Blog Entries
    7
    Rep Power
    21

    Default Re: [Java Eclipse] About this problem

    Start with a number 1;
    multiply by 2 (result is 2)
    multiply by 2 again (result is 4)
    multiply by 2 again (result is 8)

    Note that you have multiplied by 2 three times ...

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  8. #8
    Aries. is offline Member
    Join Date
    Jan 2013
    Posts
    22
    Rep Power
    0

    Default Re: [Java Eclipse] About this problem

    Quote Originally Posted by JosAH View Post
    Start with a number 1;
    multiply by 2 (result is 2)
    multiply by 2 again (result is 4)
    multiply by 2 again (result is 8)

    Note that you have multiplied by 2 three times ...

    kind regards,

    Jos
    I tried it already I already loop for the second number to multiply itself from the first number but the answer is too far.

  9. #9
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,776
    Blog Entries
    7
    Rep Power
    21

    Default Re: [Java Eclipse] About this problem

    Quote Originally Posted by Aries. View Post
    I tried it already I already loop for the second number to multiply itself from the first number but the answer is too far.


    Conclusion: your code isn't corrrect.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  10. #10
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default Re: [Java Eclipse] About this problem

    ...and without seeing the code (including your output and any debugging you have done) we can't say why it is wrong.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. Replies: 1
    Last Post: 03-26-2012, 04:53 PM
  2. eclipse java and max msp problem! HELP!!
    By max&java in forum Advanced Java
    Replies: 1
    Last Post: 11-28-2011, 02:56 AM
  3. JAVA, Eclipse problem in Win 7 64 bit ?
    By makpandian in forum New To Java
    Replies: 4
    Last Post: 10-10-2011, 08:02 AM
  4. java problem in eclipse.
    By drasticthunder in forum Threads and Synchronization
    Replies: 1
    Last Post: 07-08-2010, 08:56 AM
  5. problem from sun's java to eclipse
    By doood123 in forum Eclipse
    Replies: 0
    Last Post: 12-18-2007, 05: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
  •