Home
Tutorials
Core Java
Introduction To Java
Java Evolution
Overview of Java
Constants, Variables and Data Types
Java Operators
Branching Statements
Looping Statements
Classes, Objects and Methods
Inheritance
Array, String and Vectors
Java Interfaces
Java Packages
Applet Programming
Graphics Programming
Advanced Java
Java AWT
Java Event Handling
Java File Handling
Java MultiThreading
Java Swing-I
Java Swing-II
Exception Handling
Socket Programming
Java Database
Java RMI
Java Servlets
Java Beans
Programms
Projects
Downloads
Contact
Java Programming
!doctype>
Tax Calulate using Java Else If Ladder
"TaxCalulate_elseIf.java"
//Tax Calculate import java.io.*; class TaxCalulate_elseIf { public static void main(String args[]) throws Exception { String bp; int ta,da,hra,ns; double tax; System.out.print("\n\tEnter the Basic Pay :\t"); BufferedReader ob = new BufferedReader(new InputStreamReader(System.in)); bp = ob.readLine(); int bp_obj = Integer.parseInt(bp); ta = bp_obj * 5 / 100; System.out.println("\n\tTravelling Allowance :\t" + ta); da = bp_obj * 8 / 100; System.out.println("\n\tDearness Allowance :\t" + da); hra = bp_obj * 4 / 100; System.out.println("\n\tTravelling Allowance :\t" + hra); ns = bp_obj + ta + da + hra; System.out.print("\n\tNet Salary= " + ns); if(ns <= 10000) { tax = 0; System.out.println("\n\tTax :\t " + tax); } else if(ns >= 100000 && ns <= 150000) { tax = (ns-100000) * 0.1; System.out.println("\n\tTax :\t " + tax); } else if(ns >= 100000 && ns <= 180000) { tax = (ns-150000) * 0.2 + 5000; System.out.println("\n\tTax :\t " + tax); } else if(ns >= 180000) { tax = (ns-180000) * 0.3 + 11000; System.out.println("\n\tTax :\t " + tax); } } }
Output of "TaxCaluate_elseif.java"
Download Complete Program
-
Read more »
No comments:
Post a Comment
No comments:
Post a Comment