All pastes #940956 Raw Edit

Stuff

public text v1 · immutable
·published 2008-03-13 12:43 UTC
rendered paste body
/* Rob Arseneault
 * Harrison Trimble
 * Mrs. Purves
 * J1
*/

import java.io.*;
class Part2
{
     public static void main (String[] args) throws IOException
    {
        InputStreamReader inStream = new InputStreamReader (System.in);
        BufferedReader stdin = new BufferedReader (inStream);
	String inData; // Declares variable for input 
	int number; // Declares variable for int
	int thousand, hundred, tens, ones,total;
	
	System.out.println ("Enter a number between 0 and 1000:"); // Command which tells user to input a number
	inData = stdin.readLine ( ); // Reads input 
	number = Integer.parseInt (inData); //Converts char into an int
	thousand = (number % 10000) / 1000;
	hundred = (number % 1000) / 100;
	tens = (number % 100) / 10;
	ones = (number % 10);
	System.out.println (thousand); //Outputs final calculation to find meters
	System.out.println (hundred); //Outputs final calculation to find meters
	System.out.println (tens); //Outputs final calculation to find meters
	System.out.println (ones); //Outputs final calculation to find meters
	total = (thousand + hundred + tens + ones);
	System.out.println ( "The sum of the numbers is: " + total); //Outputs final calculation to find meters
        
    }
}