Zum Inhalt springen

Kurs:Java (Kjell)/Code-Rubrik/Dollar.java

Aus Wikiversity
Dollar.java

Programmcode

[Bearbeiten]
package kapitel_10;

import java.io.*;

class Dollar {

	  public static void main (String[] args) throws IOException {
		
	    BufferedReader stdin =
	        new BufferedReader ( new InputStreamReader( System.in ) );
	    
	    String inData;
	    int dollar, cent; 
	    
	    System.out.println("Geben Sie die Cent ein:");
	    inData = stdin.readLine();
        cent = Integer.parseInt(inData);
        
        dollar = cent / 100;
        cent = cent % 100;
	    
	    System.out.println("Das ergibt " + dollar + 
	    		           " Dollar und  " + cent + " Cent." );
  }	
	
	
	
}