Advertisement
Guest User

MP 1 Make Change

a guest
Jan 16th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.85 KB | None | 0 0
  1. package make_change;
  2.  
  3.  
  4. import java.util.Scanner;
  5.  
  6. public class MakeChange {
  7.  
  8.    
  9.     public static void main(String[] args) {
  10.        
  11.         Scanner input = new Scanner(System.in);
  12.        
  13.         int dollarPrice;
  14.         int centsPrice;
  15.        
  16.         System.out.println("Enter in the number of dollars.");
  17.         dollarPrice = input.nextInt();
  18.         System.out.println("Enter the amount of cents.");
  19.         centsPrice = input.nextInt();
  20.        
  21.         int dollarsRecieved;
  22.         int centsRecieved;
  23.        
  24.         System.out.println("Enter the amount of dollars given.");
  25.         dollarsRecieved = input.nextInt();
  26.         System.out.println("Enter the amount of cents given.");
  27.         centsRecieved = input.nextInt();
  28.        
  29.         int totalPrice;
  30.         totalPrice = (dollarPrice + centsPrice);
  31.        
  32.         int totalRecieved;
  33.         totalRecieved = (dollarsRecieved + centsRecieved);
  34.        
  35.         System.out.println(totalRecieved - totalPrice);
  36.        
  37.        
  38.     }
  39.  
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement