# Calculate hra,da and gross salary of worker by passing Object as Parameter

by Dinesh Thakur Category: Classes

import java.io.*;

class salary
{
float h,d,g;
void sal(salaryobj m)
{
h=(float)m.s*60/100;
d=(float)m.s*98/100;
g=h+d;
System.out.println("HRA is:"+h);
System.out.println("DA is:"+d);
System.out.println("Gross Salary is:"+g);
}
};
class salaryobj
{
String n,h;
int  c,s;
salaryobj()
throws IOException
{
System.out.println("Enter code ");
c=Integer.parseInt(h);
System.out.println("Enter name ");
System.out.println("Enter salary ");
s=Integer.parseInt(h);
}
void showdata()
{
System.out.println("Code number :"+c);
System.out.println("worker;s name :"+n);
System.out.println("Salary :"+s);
}
public static void main(String args[]) throws IOException
{
salaryobj k=new salaryobj();
k.showdata();
salary p=new salary();
p.sal(k);
}
}

Dinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.

Search Content

Popular Article