Results 1 to 5 of 5
 09192011, 06:15 AM #1Member
 Join Date
 Sep 2011
 Location
 US
 Posts
 16
 Rep Power
 0
how to present thousands, hundreds, tens, and ones ...
Hi guys ..
I am so happy that I found this forum which will help me a lot to improve my java skills.
this is my first question which I tried so many times to fighter out the answer..
tomorrow is the due date for this program so please if you could help me to find an answer for this program ...
I wrote the program .. I guess it's right however I want to know how to present the thousands, hundreds, tens, and ones place value using / and %
this is my program .. Am I doing right ? I attached tow in case ..
please I need a help guys .. I really appreciate your read :)

Re: how to present thousands, hundreds, tens, and ones ...
Please post your code as text, not as an image. Place the tag [code] above your code block and [/code] below your code block so it retains its formatting. Also, rather than ask "am I doing right", please tell us what happens when you test it. Are you getting any errors? Is the output as expected?
 09192011, 07:02 AM #3Member
 Join Date
 Sep 2011
 Location
 US
 Posts
 16
 Rep Power
 0
Re: how to present thousands, hundreds, tens, and ones ...
I am sorry this is it
Java Code://Problem Analysis //Input:Four digit Number //Process:1) Check input for appropriate length (size) – if too small or too large give a message and exit //2) Find the thousands, hundreds, tens, and ones place value. Calculate the sum and product of the four digits. //3) Determine appropriate message for product //Output:Initial integer with sum and product of digits in a suitable format //Hint: Use the % operator to extract digits, and use the / operator to remove the extracted digits. //For instance 932 % 10 = 2 and 932 / 10 = 93.
Java Code:public class Program2 { public static void main(String[] args) { String userInput = JOptionPane .showInputDialog("Enter a positive four digit number between 1000 and 9999: "); int fourDigitNumber = Integer.parseInt(userInput); if ( fourDigitNumber <= 999 ) if ( fourDigitNumber > 9999) { JOptionPane.showMessageDialog(null, "Number is not a positive four digit number between 1000 and 9999 inclusive.", "Sami's Program", JOptionPane.ERROR_MESSAGE); } else { JOptionPane.showMessageDialog(null, "The original number is:" + String + "The sum of the four digits is:" + sum + "The product of the four digits is:" + product , "me", JOptionPane.PLAIN_MESSAGE); } int inputString = (userInput); int sum = int product = System.exit(0); } }

Re: how to present thousands, hundreds, tens, and ones ...
 09192011, 07:15 AM #5Member
 Join Date
 Sep 2011
 Location
 US
 Posts
 16
 Rep Power
 0
Re: how to present thousands, hundreds, tens, and ones ...
Yes you are right. I am sorry maybe because of my english a little weak. I wrote this program as the instruction said
//Problem Analysis
//Input:Four digit Number
//Process:1) Check input for appropriate length (size) – if too small or too large give a message and exit
//2) Find the thousands, hundreds, tens, and ones place value. Calculate the sum and product of the four digits.
//3) Determine appropriate message for product
//Output:Initial integer with sum and product of digits in a suitable format
//Hint: Use the % operator to extract digits, and use the / operator to remove the extracted digits.
//For instance 932 % 10 = 2 and 932 / 10 = 93.
Also how can I present the ( origin, sum and product ) ?
Similar Threads

What is the most efficient data structure for storing possibly upto thousands of ...
By oontvoo in forum Advanced JavaReplies: 4Last Post: 08052011, 05:10 PM 
how to access a file in the present folder.
By AnanthNag.Kundanala in forum New To JavaReplies: 2Last Post: 01112011, 04:40 PM 
longest word present in a string
By somnath6088 in forum New To JavaReplies: 4Last Post: 11092010, 06:43 PM 
How to read a .EML file present on Remote Desktop?
By anil@prokarma in forum New To JavaReplies: 0Last Post: 06122008, 03:05 PM 
To send email of page present Web from a Jsp
By Marcus in forum JavaServer Pages (JSP) and JSTLReplies: 1Last Post: 06092007, 05:08 AM
Bookmarks