import java.util.Scanner;public class Money { private int dollars; private int cents; private int firstDollars; private int firstCents; private int secondDollars; private int secondCents; public int getCents() { return cents; } public void setCents(int cents) { this.cents = cents; } public int getDollars() { return dollars; } public void setDollars(int dollars) { this.dollars = dollars; } public Money() { dollars = 0; cents = 0; } public Money(int dollars) { this.dollars = dollars; } public Money(int dollars, int cents) { this.dollars = dollars; this.cents = cents; } public void readInput() { Scanner keyboard = new Scanner(System.in); System.out .println("Enter two amounts of money. " + "Put a space between the dollars and cents. Do not use a decimal."); firstDollars = keyboard.nextInt(); firstCents = keyboard.nextInt(); secondDollars = keyboard.nextInt(); secondCents = keyboard.nextInt(); } Money firstAmount = new Money(firstDollars, firstCents); Money secondAmount = new Money(secondDollars, secondCents); Money theResult = new Money(); public void addMoney() { int firstCents = firstAmount.getCents(); int secondCents = secondAmount.getCents(); int totalCents = firstCents + secondCents; if (totalCents > 100) { theResult.setDollars(dollars + 1); theResult.setCents(totalCents - 100); } else theResult.setCents(totalCents); int firstDollars = firstAmount.getDollars(); int secondDollars = secondAmount.getDollars(); int totalDollars = firstDollars + secondDollars; theResult.setDollars(totalDollars); System.out.println("The total is $" + theResult.dollars + "." + theResult.cents + "."); } public void subtractMoney() { int firstCents = firstAmount.getCents(); int secondCents = secondAmount.getCents(); if (firstCents < secondCents) { theResult.setDollars(dollars-1); theResult.setCents(cents + 100); } int totalCents = firstCents - secondCents; theResult.setCents(totalCents); int firstDollars = firstAmount.getDollars(); int secondDollars = secondAmount.getDollars(); int totalDollars = firstDollars + secondDollars; theResult.setDollars(totalDollars); System.out.println("The total is $" + theResult.dollars + "." + theResult.cents + "."); }}