Home Java Java Money Counter Calculator App

Java Money Counter Calculator App

2 min read
0
0
620

In this tutorials will teach Java Money Counter Calculator App step by step.

Paste the code inside the calculate button.

int salary = Integer.parseInt(txtSal.getText());
       int notes,coins;
       
       notes = salary / 5000;
       salary = salary % 5000;
       System.out.println("5000 notes : " + notes);
       int fivethusand = notes;
      
       notes = salary / 1000;
       salary = salary % 1000;
       System.out.println("1000 notes : " + notes);
        int thusand = notes;
       
       notes = salary / 500;
       salary = salary % 500;
       System.out.println("500 notes : " + notes);
       int fivehundred = notes;
        
       notes = salary / 100;
       salary = salary % 100;
       System.out.println("100 notes : " + notes);
        int hundred = notes;
        
       
       notes = salary / 50;
       salary = salary % 50;
       System.out.println("50 notes : " + notes);
        int fifty = notes;
        
       notes = salary / 20;
       salary = salary % 20;
       System.out.println("20 notes : " + notes);
        int twenty = notes;
       
       coins = salary / 10;
       salary = salary % 10;
       System.out.println("10 coins : " + coins);
        int ten = coins;
       
       coins = salary / 5;
       salary = salary % 5;
       System.out.println("5 coins : " + coins);
       int five = coins;
       
       coins = salary / 2;
       salary = salary % 2;
       System.out.println("2 coins : " + coins);
        int two = coins;
       System.out.println("1 coins : " + salary);
        int one = salary;
       
       
       JOptionPane.showMessageDialog(this, "5000 notes " + fivethusand+ "\n" +
                                                         "1000 notes " + thusand+ "\n" + 
                                                         "500 notes " + fivehundred+ "\n" +   
                                                         "100 notes " + hundred+ "\n" + 
                                                         "50 notes " + fifty+ "\n" +    
                                                         "20 notes " + twenty+ "\n" + 
                                                         "10 coins " + ten+ "\n" + 
                                                         "5 coins " + five+ "\n" +   
                                                         "2 coins " + two+ "\n" + 
                                                         "1 coins " + one+ "\n" 
                
                );

 

 

 

Load More Related Articles
  • Conditional Statements in Python

    Conditional statements in Python allow us to control the flow of execution based on condit…
  • Java Beans

    A Java Bean is a reusable software component that follows a specific set of conventions. J…
  • Java String Methods

    Java provides a rich set of built-in methods for handling String operations efficiently. S…
Load More By admin
  • Java Beans

    A Java Bean is a reusable software component that follows a specific set of conventions. J…
  • Java String Methods

    Java provides a rich set of built-in methods for handling String operations efficiently. S…
  • Java Developer Jobs

    Java remains one of the most in-demand programming languages worldwide, powering everythin…
Load More In Java

Leave a Reply

Your email address will not be published. Required fields are marked *

Check Also

Conditional Statements in Python

Conditional statements in Python allow us to control the flow of execution based on condit…