Respuesta :
The program that determines the change to be dispensed from a vending machine is illustrated below
How to depict the program?
import java.util.Scanner; //to accept input from user
public class Main { //class name
public static void main(String[] args) { //start of main function
Scanner input =new Scanner(System.in); // creates Scanner class object
int amount, quarters, dimes, nickels, pennies,change; //declare variables
System.out.println("Enter the price of the(from 25 cents to a dollar, in 5-cent increments): "); //prompts user to enter the price
amount=input.nextInt(); //reads amount from user
change= 100-amount; //computes change
System.out.println("You bought an item for " + amount+" cents and gave me a dollar, so your change is :");
quarters=change/25; //computes quarters
change=change%25; //computes quarter remaining
if(quarters == 1) // if quarter is equal to 1
System.out.println(quarters+ " quarter"); //prints quarter value in singular
else if (quarters>1) // if value of quarters is greater than 1
System.out.println(quarters+" quarters"); //prints plural quarters value
dimes=change/10; //computes dime
if(dimes == 1) // if value of dime is equal to 1
System.out.println(dimes+ " dime"); //prints single value of dimes
else if (dimes>1) //if value of dimes is greater than 1
System.out.println(dimes+" dimes"); //prints plural value of dimes
change=change%10; //computes dimes remaining
nickels=change/5; //computes nickels
if(nickels == 1) //if value of nickels is equal to 1
System.out.println(nickels+ " nickel"); //prints single value of nickels
else if (nickels>1) //if value of nickels is greater than 1
System.out.println(nickels+" nickels"); //prints plural value of nickels
change=change%5; //computes nickels remaining
pennies=change; //computes pennies
if(pennies == 1) //if value of pennies is equal to 1
System.out.println(pennies+ " penny"); //prints single value of pennies
else if (pennies>1) //if value of pennies is greater than 1
System.out.println(pennies+" pennies"); } } //prints plural value of pennies
Learn more about program on:
https://brainly.com/question/1538272
#SPJ1