Simple tax calculator - Java

A simple tax calculator program created in java.
Write a program that defines a floating-point variable initialized with a value for your code and a second floating-point variable initialized with a value corresponding to a tax rate of 35 percent. Calculate and output the amount of tax you must pay.

import java.util.Scanner;

class thirdappagain
    public static void main(String args[])
        Scanner sc = new Scanner(;
        float taxrate=35, income, totaltax, totalamount;
        System.out.print("\nPlease insert your income :: ");
        income = sc.nextFloat();
        System.out.print("\nPlease insert tax-rate :: ");
        taxrate = sc.nextFloat();        
        totaltax = income*(taxrate/100);        
        totalamount = income+totaltax;        
        System.out.println("\nYour total Income is Rs. "+income+" /-");
        System.out.println("\nTotal tax on your income is Rs. "+totaltax+" /-");
        System.out.println("\nTotal amount you need to pay is Rs. "+totalamount+" /-");

Post a Comment