The following is the program I wrote, but the result is not what is required exatly.
Somebody please point me out to what I am doing wrong.

The question:

Write a Java application that reads an integer value between 0 and 100 (inclusive), representing the amount of a purchase in cents. Produce an error message if the input value is not in that range. If the input is valid, determine the amount of change that would be received from one dollar, and print the number of quarters, dimes, nickels, and pennies that should be returned. Maximize the coins with the highest value. Follow the format below. The user input is shown in boldface:

Enter the purchase amount [0-100]: 36
Your change of 64 cents is given as:

2 Quarters
1 Dimes
0 Nickels
4 Pennies

Hint: Use integer division and the % operator, also known as the mod operater. For example, 64/25 equals 2, and 64 % 25 equals 14. You must store your intermediate calculations in variables, not just redo every step over in the print statement!

The program:

// make change in dimes etc.


class MakeChange


{
public static void main (String[] args)
{
int price, change, quarters, dimes, pennies;


System.out.println("type price(0:100):");


price = 36;


change = 100 - price; // how much change
quarters = change / 2; // number of quarters
dimes = change / 1; // number of dimes
pennies = change / 4; // number of pennies


System.out.print("The change is:");
System.out.print(quarters);
System.out.print("quarters");
System.out.print(dimes);
System.out.print("dimes");
System.out.print(pennies);
System.out.print("pennies.\n");
}
}

Where do you exatly do this?

Write a Java application that reads an integer value between 0 and 100 (inclusive)

And why don't you use HINT for this part????

change = 100 - price; // how much change
quarters = change / 2; // number of quarters
dimes = change / 1; // number of dimes
pennies = change / 4; // number of pennies

I thought we were suppose to make it interactive

check the Java api's for the Scanner class

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.