/* * ATM.java * * Created on 23 Οκτώβριος 2012, 9:30 πμ * * The purpose is by using Modulo Arithmetic to construct a program that will calculate * the change to be given to a person in 50, 20, 10 , 5, 2, 1 Euros when we know the price of * the object and the amount given. Try to complete the program below using suitable variables * for each bankrnote, and give a formated output for all banknotes. * */ import java.io.*; public class ATM { int amount, price; String data; /** Creates a new instance of ATM */ public ATM() { } public void insert() throws IOException{ InputStreamReader inStream=new InputStreamReader(System.in); BufferedReader stdin=new BufferedReader(inStream); System.out.print("Input price of the Item: "); data = stdin.readLine(); amount = Integer.parseInt(data); System.out.print("Input amount from Client: "); data = stdin.readLine(); price = Integer.parseInt(data); } public void ATM(){ int change = amount - price; int e50 = change / 50; change = change % 50; System.out.println("Euro 50 : " + e50); //20 //10 //5 //2 //1 } public static void main(String[] args) { } }