Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package make_change;
- import java.util.Scanner;
- public class MakeChange {
- public static void main(String[] args) {
- Scanner input = new Scanner(System.in);
- int dollarPrice;
- int centsPrice;
- System.out.println("Enter in the number of dollars.");
- dollarPrice = input.nextInt();
- System.out.println("Enter the amount of cents.");
- centsPrice = input.nextInt();
- int dollarsRecieved;
- int centsRecieved;
- System.out.println("Enter the amount of dollars given.");
- dollarsRecieved = input.nextInt();
- System.out.println("Enter the amount of cents given.");
- centsRecieved = input.nextInt();
- int totalPrice;
- totalPrice = (dollarPrice + centsPrice);
- int totalRecieved;
- totalRecieved = (dollarsRecieved + centsRecieved);
- System.out.println(totalRecieved - totalPrice);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement