Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: Rewrite multiplications code

  1. #1
    Junior Member
    Join Date
    Jan 2014
    Posts
    7
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Rewrite multiplications code

    I write this code for two particulars numbers. Can someone help me to rewrite with random numbers.
    import javax.swing.*;
    import java.text.*;
    public class multiplication
    { public static void main (String []args)
    { String input =
    JOptionPane.showInputDialog("What is 4 times 8:");
    int a = new Integer(input).intValue();
    double b = 4*8;
    JOptionPane.showMessageDialog(null, "4 times 8 is 32 your guess of 33 was false:" );

    }
    }


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Rewrite multiplications code

    What have you tried?
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,520
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: Rewrite multiplications code

    Also, search for generating random numbers in Java. There are a couple different ways to do it.

  4. #4
    Junior Member
    Join Date
    Jan 2014
    Posts
    7
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Rewrite multiplications code

    I don't now how to generate for random numbers

  5. #5
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Rewrite multiplications code

    Quote Originally Posted by Rinor View Post
    I don't now how to generate for random numbers
    What have you tried?
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. Please solve my problem
    By Supun Pramoda in forum What's Wrong With My Code?
    Replies: 14
    Last Post: December 8th, 2013, 12:14 AM
  2. please solve my problem
    By anarica in forum What's Wrong With My Code?
    Replies: 3
    Last Post: September 12th, 2013, 07:35 AM
  3. Pleas help! array index out of bouderies
    By ProgrammerNoobE in forum What's Wrong With My Code?
    Replies: 3
    Last Post: May 29th, 2013, 04:30 AM
  4. Please solve my problem
    By Nurhafizah in forum What's Wrong With My Code?
    Replies: 1
    Last Post: December 16th, 2012, 10:11 PM
  5. Need help to solve this problem
    By ahanf in forum Object Oriented Programming
    Replies: 1
    Last Post: June 3rd, 2012, 05:00 AM