// Lab 2, problem 1. import java.util.Scanner; class ChangeValue { public static void main (String[] args) { Scanner scan = new Scanner(System.in); System.out.print ("Enter the number of qurters: "); System.out.flush(); int quarters = scan.nextInt(); System.out.print ("Enter the number of dimes: "); System.out.flush(); int dimes = scan.nextInt(); System.out.print ("Enter the number of nickels: "); System.out.flush(); int nickels = scan.nextInt(); System.out.print ("Enter the number of pennies: "); System.out.flush(); int pennies = scan.nextInt(); int value = quarters * 25 + dimes * 10 + nickels * 5 + pennies; int dollars = value / 100; int cents = value % 100; System.out.println (quarters + " quarters + " + dimes + " dimes + " + nickels + " nickels + " + pennies + " pennies = " + dollars + " dollars and " + cents + " cents."); } }