Tuesday, March 23, 2010

Salary Program(Enter Name, Salary, Calculate Tax etc)

import java.io.*;

public class salary
{ String name, add, subsp;
double phone, monsal, intax;

void accept() throws IOException
{ InputStreamReader read = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(read);

System.out.println("Enter the teacher name");
name = br.readLine();
System.out.println("Enter the teacher's address");
add = br.readLine();
System.out.println("Enter the teacher's phone number");
phone = Integer.parseInt(br.readLine());
System.out.println("Enter the teacher's subject specialization");
subsp = br.readLine();
System.out.println("Enter the teacher's monthly salary");
monsal = Double.parseDouble(br.readLine());
}

void compute()
{ if(monsal<175000)
intax=0;
else
intax = (monsal-175000)*0.05;
}

void show()
{ System.out.println("TEACHER DETAILS--------\n\n");
System.out.println("NAME: " +name);
System.out.println("ADDRESS: " +add);
System.out.println("PHONE NUMBER: " +phone);
System.out.println("SUBJECT SPECIALIZATION: " +subsp);
System.out.println("MONTHLY SALARY: " +monsal);
System.out.println("INCOME TAX: " +intax);
}

public static void main(String args[]) throws IOException
{ salary abc = new salary();
abc.accept();
abc.compute();
abc.show();
}
}

Dont just blindly copy paste this one-there's a small fuckup inside
(salary must be multiplied by 12 to calculate income tax)

4 comments:

  1. Help for this programme
    1 2 3 4 5
    1 2 3 4
    1 2 3
    1 2
    1

    ReplyDelete
    Replies
    1. for(r=5;r>=1;r--)
      {
      for(c=1;c<=r;c++)
      {
      System.out.print(c);
      }
      System.out.println("");
      }

      Delete
  2. This comment has been removed by the author.

    ReplyDelete