Advertisement
SourCB

ch2ex5 start....

Feb 13th, 2014
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.52 KB | None | 0 0
  1. //Jake Robbins
  2.  
  3.  
  4.  
  5.         import java.util.Scanner;
  6.  
  7.         public class ch2ex4
  8.      {
  9.  
  10.  
  11.         public static void main ( String[ ] args )
  12.     {
  13.  
  14.         Scanner scan = new Scanner( System.in );
  15.  
  16.  
  17.         int x, y, dollars, cents;
  18.         y = 100;
  19.  
  20.         System.out.println("Input your change:");
  21.         x = scan.nextInt();
  22.  
  23.         cents = x % y;
  24.         dollars = x / y;
  25.  
  26.  
  27.         System.out.println("That is " + dollars + " " + "dollars and" + " " + cents + " " + "cents");
  28.  
  29.  
  30.  
  31.  
  32.  
  33.     }
  34.  
  35.  
  36.  
  37.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement