Ex 1: Create a BankTeller class. Write a Bank Teller Console application (started below), which will calculate the optimum combination of notes to be handed out to customers.
A variable Sterling contains the number of pounds sterling to be handed out. The program then works out how many fifties, how many twenties, how many tens, fives and how many one pound coins should be issued. The program output to the console these values.
public class BankTeller {
public static void main(String args[]) {
int sterling=189; //try different values to check your code
int fifties, twenties, tens, fives, ones;
}
}
The modulus operator '%' gives the remainder after division, e.g.
5%2 = 1
11%3 = 2
Test your program with different values for the sterling variable.
Ex 2: Amend your program to provide notes and coins for a floating point sterling value
e.g. float sterling = 26.11;
output should indicate:
1 twenty, 1 five, 1 pound, 0 fifty pence, 0 twenty pence, 1 ten pence, 0 five pence, 1 penniesD