Discussion topic: Contributed Answer/Explanation to Q. 1
To go to the homepage of this topic,
click here.
Home: ezhilmathi | Original Message | Reply | Subject: Contributed Answer/Explanation to Q. 25 | program:
public class Salary
{
String Name ; String Address; long Phone; String Subject Specialisation
; int Monthly Salary ; float Income Tax;
public void accept( )
{
System.out.println("Enter your name, address, phone number, subject
specialisation, monthly salary in the same order");
String n = in.readLine( );
String add = in.readLine( );
int no = Integer.parseInt ( in.readLine( ) );
String sub = in.readLine( );
int sal = Integer.parseInt( in.readLine( ));
Name = n;
Address = add;
Phone = no;
Subject Specialisation = sub;
Monthly Salary = sal;
}
public void display( )
{
System.out.println(" Your name is " + Name);
System.out.println(" Your address is " + Address);
System.out.println(" Your phone number is "+ Phone);
System.out.println(" Your specialised subject is " + Subject
Specialisation);
System.out.println(" Your monthly salary is"+ Monthly Salary);
}
public float calc( )
{
float anS = 12* Monthly Salary;
if ( anS >= 175000 )
tax = 0.05* anS;
else
tax = 0;
}
public void main( )
{
Salary obj = new Salary ;
float ans = obj.calc( );
System.out .println (" The annual tax is " + ans);
}
}
Posted at: Wed Dec 1 18:17:23 2010 (GMT) |
Page 1 of 1 | From: ezhilmathi | Reply 1 of 1 | Reply | | Subject: Contributed Answer/Explanation to Q. 25 | program:
import java.io*;
public class Salary
{
String Name ; String Address; long Phone; String Subject Specialisation
; int Monthly Salary ; float Income Tax;
public void accept( )
{
InputStreamReader read = new InputStreamReader( System.in);
BufferedReader in = new BufferedReader(read);
System.out.println("Enter your name, address, phone number, subject
specialisation, monthly salary in the same order");
String n = in.readLine( );
String add = in.readLine( );
int no = Integer.parseInt ( in.readLine( ) );
String sub = in.readLine( );
int sal = Integer.parseInt( in.readLine( ));
Name = n;
Address = add;
Phone = no;
Subject Specialisation = sub;
Monthly Salary = sal;
}
public void display( )
{
System.out.println(" Your name is " + Name);
System.out.println(" Your address is " + Address);
System.out.println(" Your phone number is "+ Phone);
System.out.println(" Your specialised subject is " + Subject
Specialisation);
System.out.println(" Your monthly salary is"+ Monthly Salary);
}
public float calc( )
{
float anS = 12* Monthly Salary;
if ( anS >= 175000 )
tax = 0.05* anS;
else
tax = 0;
}
public void main( )
{
Salary obj = new Salary ;
obj.accept;
obj.display;
float ans = obj.calc( );
System.out .println (" The annual tax is " + ans);
}
}
Posted at: Wed Dec 1 18:23:52 2010 (GMT)
|
Page 1 of 1
|
|
To post to this forum, you must be signed in as a Syvum member.
Please sign in / register as a member.