Tuesday, August 20, 2019

BlueJ Program On Notes Of Different Denominations

This is a BlueJ program on notes of different denominations.


Write a program to display an amount in rupees in terms of notes of different denominations. If the amount is 1782, the output will be
Rs. 500 notes 3
Rs. 100 notes 2
Rs. 50 notes 1
Rs.20 notes 1
Rs.10 notes 1
Rs. 5 notes 0
Rs. 2 notes 1
Rs.1 notes 0



If the amount is 2023

Rs. 2000 notes 1
Rs. 500 notes 0
Rs. 100 notes 0
Rs. 50 notes 0
Rs.20 notes 1
Rs.10 notes 0
Rs. 5 notes 0
Rs. 2 notes 1
Rs.1 notes 1

import java.io.*;
class Bank
{
int rev,amount;
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
public void intake() throws IOException
{
System.out.println("Enter the Amount:");
amount=Integer.parseInt(br.readLine());
System.out.println("\nDENOMINATORS:\n");
rev=amount/2000;

System.out.println("Rs. 2000 Notes: " + rev );

amount=amount%2000;
rev=amount/500;
System.out.println("Rs. 500  Notes: " + rev );
amount=amount%500;
rev=amount/100;
System.out.println("Rs. 100  Notes: " + rev );
amount=amount%100;
rev=amount/50;
System.out.println("Rs. 50  Notes: " + rev );
amount=amount%50;
rev=amount/20;
System.out.println("Rs. 20  Notes: " + rev );
amount=amount%20;
rev=amount/10;
System.out.println("Rs. 10  Notes: " + rev );
amount=amount%10;
rev=amount/5;

System.out.println("Rs. 5  Notes: " + rev );
amount=amount%5;
rev=amount/2;
System.out.println("Rs. 2  Notes: " + rev );
amount=amount%2;
rev=amount/1;
System.out.println("Rs. 1  Notes: " + rev );
}
public static void main(String args[])throws Exception
{
     Bank ob=new Bank();
     ob.intake();
    }
}


Related PostBlueJ Programs on Number

No comments:

Post a Comment

Subscribe via email

Enter your email address:

Delivered by FeedBurner