Java Language Provide Four Different Types of Cases to write the name.
When you will write code then you should focus on the naming convention, it provides the ways to provide the name of Variable, Constant, package, Methods, Class, and Interface.
1 lower case:- for a keyword, for variable, single word method, package-name
example
class, static, void, main these all are a keyword in java, it's have been defined in lower case.
2 Proper Case or initial or Capitalize:-
Classname, Interfacename
3 Camel Case:-
the first word all char in lower case and the second word first char will be in caps and the same pattern will apply to all words.
The method name which contains more than one word will be in Camel case in java.
toString()
indexOf()
lastIndexOf()
4 Upper case:-
Constant in Java should be declared in Upper Case.
ASSIGNMENT OF JAVA Program:-
1 WAP to create a Salary Calculator of an employee using basic, ta, da, comm, pf, number of leave.
calculate net salary and gross salary
basic:-20000
ta:- 2000
da:- 2500
comm:- 30000
pf:- 2000 (1000 emp and 1000comp)
leave:-
2) WAP to calculate the multiplication of Complex numbers?
The solution of this program:-
import java.util.Scanner;
class Complex
{
public static void main(String args[])
{
Scanner sc= new Scanner(System.in);
System.out.println("Enter first complex number");
String comp1 = sc.next(); //2+3i
System.out.println("Enter second complex number");
String comp2 = sc.next(); //4+5i
int plusindex = comp1.indexOf("+"); //1
int iotaindex = comp1.indexOf("i"); //3
int r1 =Integer.parseInt(comp1.substring(0,plusindex)); //2
int i1 = Integer.parseInt(comp1.substring(plusindex,iotaindex)); //3
int plusindex1 = comp2.indexOf("+"); //1
int iotaindex1 = comp2.indexOf("i"); //3
int r2 =Integer.parseInt(comp2.substring(0,plusindex1)); //4
int i2 = Integer.parseInt(comp2.substring(plusindex1,iotaindex1)); //5
int r = r1*r2-i1*i2;
int i = r1*i2+r2*i1;
System.out.println(comp1 + "\n" + comp2);
System.out.println(r + "+" + i + "i");
}
}
3) WAP to calculate the area of a triangle using heron's formula in java?
4) WAP to calculate age where the son is 20 years younger than the father and 18 years younger than the mother what will be the age of the son, father, and mother, calculation start year will be entered by the user?
next blogger.com/blog/post/edit/7768209714160124788/1813306666040951691
import java.util.Scanner;
ReplyDeleteclass Salary
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int bs,ta,da,pf,leave,comm,net,gross,it;
System.out.println("Enter basic salary");
bs=sc.nextInt();
System.out.println("Enter travelling allounce ");
ta=sc.nextInt();
System.out.println("Enter daily allounce");
da=sc.nextInt();
System.out.println("Enter Connmmission");
comm=sc.nextInt();
System.out.println("Enter no. of leave");
leave=sc.nextInt();
System.out.println("Enter amount of pf");
pf=sc.nextInt();
gross=bs+ta+da+comm;
System.out.println("n\n\n\n\n\nGross salary is ="+gross);
net=gross-pf-(leave*200);
System.out.println("Net salary ="+net);
int total=12*net;
System.out.println("Total salary per year ="+total);
if(total<=250000)
System.out.println("NO INCOME TAX");
else if(total<500000)
{
total=total-250000;
it=(int)(total*.05);
System.out.println("Income Tax to be payed ="+it);
}
else if(total<=1000000)
{
total=total-250000;
it=(int)(total*.2);
System.out.println("Income Tax to be payed ="+it);
}
else if(total>1000000)
{
total=total-250000;
it=(int)(total*.3);
System.out.println("Income Tax to be payed ="+it);
}
}
}
class Salary
ReplyDelete{
public static void main(String args[])
{
int base=20000, ta=2000, da=2500,comm=30000,pf=2000, leave=2;
int net, gross, l;
gross=base+ta+da+comm;
l=(gross/30)*leave;
net=gross-pf-l;
System.out.println("Gross Salary is: " +gross);
System.out.println("Net Salary is: " +net);
}
}
Q: WAP to create a Salary Calculator of an employee using basic, ta, da, comm, pf, number of leave. calculate net salary and gross salary.
ReplyDeleteSol:
class Gsalary
{
public static void main(String...salary)
{
int bs=20000,ta=2000,da=2500,comm=30000,pf=2000,leave=6,gs,nets; //200₹ per day cut on leave
gs=bs+ta+da+comm;
System.out.println("Gross salary is :- "+gs);
nets=gs-pf-(leave*200);
System.out.println("Net Salary is :- "+nets);
}
}
Q: WAP to calculate the area of a triangle using heron's formula in java?
ReplyDeleteSol:
class Htriangle
{
public static void main(String[] args)
{
double a=3,b=4,c=5,ar,sum;
sum=(a+b+c)/2;
ar=Math.sqrt(sum*(sum-a)*(sum-b)*(sum-c));
System.out.println("Area is "+ar);
}
}
1 WAP to create a Salary Calculator of an employee using basic, ta, da, comm, pf, number of leave.
ReplyDeleteclass Slip
{
public static void main(String[]args)
{
float comm=30000, basic, ta, da, pf, a=20000;
basic= a;
pf= basic-2000;
ta= pf-2000;
da= ta-2500;
System.out.println("comm"+comm);
System.out.println("basic"+basic);
System.out.println("pf"+pf);
System.out.println("ta"+ta);
System.out.println("da"+da);
}
}
1 WAP to create a Salary Calculator of an employee using basic, ta, da, comm, pf, number of leave.
ReplyDeleteclass Slipay
{
public static void main(String[]args)
{
double comm=30000, basic, ta, da, pf, leave, cut, credit, a=20000, b=666.66;
basic= a;
leave= a-(b*2);
pf= basic-2000;
ta= pf-2000;
da= ta-2500;
cut= basic-leave;
credit= a-2000-2000-2500-cut;
System.out.println("comm"+comm);
System.out.println("basic"+basic);
System.out.println("leave"+leave);
System.out.println("pf"+pf);
System.out.println("ta"+ta);
System.out.println("da"+da);
System.out.println("cut"+cut);
System.out.println("credit="+credit);
}
}
class Slipay
ReplyDelete{
public static void main(String[]args)
{
double comm=30000, basic, ta, da, pf, leave, cut, credit, a=20000, b=666.66;
basic= a;
pf= basic-2000;
ta= pf-2000;
da= ta-2500;
leave= a-(b*2);
cut= basic-leave;
credit= a-2000-2000-2500-cut;
System.out.println("comm"+comm);
System.out.println("basic"+basic);
System.out.println("pf"+pf);
System.out.println("ta"+ta);
System.out.println("da"+da);
System.out.println("afterleave"+leave);
System.out.println("leavecut"+cut);
System.out.println("credit="+credit);
}
}
1 WAP to create a Salary Calculator of an employee using basic, ta, da, comm, pf, number of leave.
ReplyDeletecalculate net salary and gross salary
basic:-20000
ta:- 2000
da:- 2500
comm:- 30000
pf:- 2000 (1000 emp and 1000comp)
leave:-2
class Salaries
{
public static void main(String[]args)
{
double comm=30000, basic=20000, ta=2000, da=2500, pf=2000, net, cut, gross, l=666.66, leaves=2;
gross= basic+ta+da+pf;
net= gross-2000-2000-2500-(l*2);
System.out.println("comm"+comm);
System.out.println("basic"+basic);
System.out.println("pf"+pf);
System.out.println("ta"+ta);
System.out.println("da"+da);
System.out.println("leaves="+leaves);
System.out.println("net="+net);
System.out.println("gross="+gross);
}
}
WAP to calculate the area of a triangle using heron's formula in java
ReplyDeleteclass Herons
{
public static void main(String[]args)
{
double Area,s,a=4,b=4,c=6;
s= (a+b+c)/2;
Area= Math.sqrt (s*(s-a)*(s-b)*(s-c));
System.out.println("Area="+Area);
}
}
Q:- WAP to calculate the area of a triangle using heron's formula in java ??
ReplyDeleteSolution:-
class Herons
{
public static void main(String[]args)
{
double Area,s,a=6,b=7,c=8;
s= (a+b+c)/2;
Area= Math.sqrt (s*(s-a)*(s-b)*(s-c));
System.out.println("Area="+Area);
}
}
WAP to calculate the multiplication of Complex number
ReplyDeleteclass Imreal
{
public static void main(String[]args)
{
float r, i, a=8, b=3, c=3, d=2;
r=a*c-b*d;
i=a*d+b*c;
System.out.println("real="+r);
System.out.println("image=" +i+"I");
}
}
I have doubt in this question
ReplyDeleteWAP to calculate age where the son is 20 years younger than the father and 18 years younger than the mother what will be the age of the son, father, and mother, calculation start year will be entered by the user
class Age
{
public static void main(String[]args)
{
float da,ma,ya,db,mb,yb,d1=22,d2=15,d3=20,m1=5,m2=3,m3=1,y1=2020,y2=2002,y3=2000;
da=d1-d3;
ma=m1-m3;
ya=y1-y3;
db=d1-d2;
mb=m1-m2;
yb=y1-y2;
System.out.println("day=" +da);
System.out.println("month=" +ma);
System.out.println("year=" +ya);
System.out.println("day=" +db);
System.out.println("month=" +mb);
System.out.println("year=" +yb);
}
}
class Salary
ReplyDelete{
public static void main(String args[])
{
int base=20000, ta=2000, da=2500,comm=30000,pf=2000, leave=2;
int net, gross, l;
gross=base+ta+da+comm;
l=(gross/30)*leave;
net=gross-pf-l;
System.out.println("Gross Salary is: " +gross);
System.out.println("Net Salary is: " +net);
}
}
class DisplayAge
ReplyDelete{
public static void main(String args[])
{
int calcyear = 1956;
int sonage,fatherage,motherage;
sonage = 2020-calcyear;
fatherage = sonage+20;
motherage = fatherage-2;
System.out.println("Son age is "+sonage);
System.out.println("Father age is "+fatherage);
System.out.println("Mother age is "+motherage);
}
}
Solution of Complex Number Multiplication:-
ReplyDeleteclass ComplexExample
{
public static void main(String args[])
{
int a=5,b=7,c=2,d=4;
int r = a*c-b*d;
int i = (a*d+b*d);
System.out.println(a + "+" + b + "i");
System.out.println(c + "+" + d + "i");
System.out.println(r + "+" + i + "i");
}
}
class salary
ReplyDelete{
public static void main(String args[])
{
float base=20000,ta=2000,da=2500,comm=30000,pf=2000,leave=5;
float net,gross,l;
gross=base+ta+da+comm;
net=gross-pf-(leave*200);
l=(gross/30)*leave;
System.out.println("gross salary is="+ gross);
System.out.println("net salary is="+ net);
System.out.println("pf salary is="+ (gross/30)*leave);
System.out.println("leave salary is="+ leave);
}
}
class multi
ReplyDelete{
public static void main(String args[])
{
float a=8,b=9,c=2,d=6;
float r,s;
r=a*c-b*d; ///r=a*b-c*d;
s=a*c-b*d; ///s=a*b+c*d;
System.out.println("reale="+r);
System.out.println("same="+s);
}
}
class heron
ReplyDelete{
public static void main(String args[])
{
float a=5,b=6,c=7;
float s,Area;
s=(a+b+c)/2;
Area=(s*(s-a)*(s-b)*(s-c));
System.out.println("Area=" +Area);
}
}
/ WAP to calculate the area of a triangle using heron's formula in java?
ReplyDeleteimport java.util.Scanner;
class Herons
{
public static void main(String abc[])
{
int s,a,b,c;
Scanner sc= new Scanner(System.in);
System.out.println("sides of triangle");
a=sc.nextInt();
b=sc.nextInt();
c=sc.nextInt();
System.out.println("the semi perameter is");
s=a+b+c/3;
System.out.println(s);
System.out.println("the area of triangle is" );
double area= Math.sqrt(s*(s-a)*(s-b)*(s-c));
System.out.println(area);
}
}
Solution by Shiva Concept For Salary Calculator Program
ReplyDeletepackage basic;
import java.util.Scanner;
public class SalaryCalc {
public static void main(String[] args) {
System.out.print("Salary Calculator");
float basic,ta,da,comm,pf,nleave,gsal,nsal,tsal;
Scanner sc = new Scanner(System.in);
System.out.print("Enter basic salary");
basic= sc.nextFloat();
System.out.print("Enter TA");
ta= sc.nextFloat();
System.out.print("Enter DA");
da= sc.nextFloat();
System.out.print("Enter comm");
comm= sc.nextFloat();
System.out.print("Enter PF");
pf = sc.nextFloat();
System.out.print("Enter NO OF LEAVE");
nleave= sc.nextFloat();
gsal= basic+ta+da+comm+pf;
tsal = basic+ta+da+comm;
nsal = tsal-pf-((tsal/30)*nleave);
System.out.println("GROSS SALARY IS "+gsal);
System.out.println("TOTAL IN HAND SALARY IS "+nsal);
System.out.println("DEDUCTION FOR PF IS "+pf + "DEDUCTION FOR LEAVE IS "+(tsal/30)*nleave);
}
}
class Salary
ReplyDelete{
public static void main(String args[])
{
int basic=20000,ta=2000,da=2500,comm=30000,pf=2000,numb_of_leave=3;
int netsalary,grosssalary;
netsalary=basic+ta+da+comm+pf;
int leave=(netsalary/30)*(numb_of_leave-1);
grosssalary=basic+ta+da+comm-pf-leave;
System.out.println("net salary="+netsalary+" "+"gross salary="+grosssalary);
}
}
1 WAP to create a Salary Calculator of an employee using basic, ta, da, comm, pf, number of leave.
ReplyDeletecalculate net salary and gross salary
class SalaryCalc
{
public static void main(String args[])
{
int basic=20000,ta=2000,da=2500,comm=30000,pf=2000,leave=3;
int net_salary=basic+ta+da+comm+pf;
int leave1=(net_salary/30)*(leave-1);
int gross_salary=basic+ta+da+comm-pf-leave1;
System.out.println(net_salary);
System.out.println(gross_salary);
}
}
kinjal singh sirohi
ReplyDelete//salary calculation
class SalaryCalculation
{
public static void main(String[]args)
{
int basic=20000,ta=2000,da=2500,comm=30000,pf=2000,leave=3;
int net_salary=basic+ta+da+comm+pf;
int leave1=(net_salary/30)*(leave-1);
int gross_salary=basic+ta+da+comm-pf-leave1;
System.out.println(net_salary);
System.out.println(gross_salary);
}
}
class ComplexMultiplication
ReplyDelete{
public static void main (String args[])
{
int real1=3,img1=2,real2=4,img2=5,real,img;
real=(real1*real2)-(img1*img2);
img=(real1*img2)+(real2*img1);
System.out.println(real+"+"+img+"i");
}
}
kinjal singh sirohi
ReplyDeleteclass ComplexMulti
{
public static void main(String[]args)
{
int real1=2,img1=5,real2=6,img2=4,real,img;
real=(real1*real2)-(img1*img2);
img=(img2*real1)-(img1*real2);
System.out.println(real+img+"i");
}
}
class HeronsFormula
ReplyDelete{
public static void main (String args[])
{
double a=3,b=4,c=5,s,area;
s=(a+b+c)/2;
area=s*(s-a)*(s-b)*(s-c);
area=Math.sqrt(area);
System.out.println("Area of triangle is "+area);
}
}
kinjal singh sirohi
ReplyDeleteclass HeronsFormula
{
public static void main(String[]args)
{
double Area,s,a=6,b=7,c=8;
s=(a+b+c)/2;
Area= Math.sqrt (s*(s-a)*(s-b)*(s-c));
System.out.println("Area="+Area);
}
}
kinjal singh sirohi
ReplyDelete//Age
import java.util.Scanner;
class Age
{
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
int year=sc.nextInt();
int father,son,mother;
father=2021-year;
son=father-20;
mother=son+18;
System.out.println(father);
System.out.println(son);
System.out.println(mother);
}
}
//WAP to calculate age where the son is 20 years younger than the father and 18 years younger than the mother what will be the age of the son, father, and mother, calculation start year will be entered by the user?
ReplyDeleteimport java.util.Scanner;
class CalculateAge
{
public static void main(String args[])
{
System.out.println("Enter Father's Birth year");
Scanner sc = new Scanner(System.in);
int year=sc.nextInt();
int father,son,mother;
father=2021-year;
son=father-20;mother=son+18;
System.out.println("Age of Father is"+father);
System.out.println("Age of son is"+son);
System.out.println("Age of Mother is"+mother);
}
}
-WAP to calculate age where the son is 20 years younger than the father and 18 years younger than the mother what will be the age of the son, father, and mother, calculation start year will be entered by the user?
ReplyDeleteimport java.util.Scanner;
class Age
{
public static void main(String args[])
{
System.out.println("Enter Son's Birth Year");
Scanner sc = new Scanner(System.in);
int Year=sc.nextInt();
int son,father,mother;
son = 2021-Year;
father = son+20;
mother = son+18;
System.out.println("Son age is "+son);
System.out.println("Father age is "+father);
System.out.println("Mother age is "+mother);
}
}
// WAP to calculate the area of a triangle using heron's formula in java?
ReplyDeleteimport java.util.Scanner;
class Herons
{
public static void main(String abc[])
{
int s,a,b,c;
Scanner sc= new Scanner(System.in);
System.out.println("sides of triangle");
a=sc.nextInt();
b=sc.nextInt();
c=sc.nextInt();
System.out.println("the semi perameter is");
s=a+b+c/3;
System.out.println(s);
System.out.println("the area of triangle is" );
double area= Math.sqrt(s*(s-a)*(s-b)*(s-c));
System.out.println(area);
}
}
#Khushboo Sendre
ReplyDelete1 WAP to create a Salary Calculator of an employee using basic, ta, da, comm, pf, number of leave.
calculate net salary and gross salary
basic:-20000
ta:- 2000
da:- 2500
comm:- 30000
pf:- 2000 (1000 emp and 1000comp)
leave:-
import java.util.Scanner;
class CalculateSalary
{
public static void main(String...args)
{
Scanner sc = new Scanner(System.in);
int bs,ta,da,pf,leave,comm,net,gross,it;
System.out.pritnln("Enter basic salary");
bs = sc.nextInt();
System.out.println("Enter travelling allounce");
ta = sc.nextInt();
System.out.println("Enter daily allounce");
da = sc.nextInt();
System.out.println("Enter commission");
comm = sc.nextInt();
System.out.println("Enter the amount of pf");
pf = sc.nextInt();
System.out.println("Enter the no. of leave");
leave = sc.nextInt();
gross = bs+ta+da+comm;
System.out.println("Gross Salary is:"+gross);
net = gross-pf-(leave*200);
int total=12*net;
System.out.println("Total salary per year="+total);
if(total<=250000)
System.out.println("No Income Tax");
else if(total<500000)
{
total = total-250000;
it=(int)(total*0.5);
System.out.println("Income tax to be payed="+it);
}
else if(total<=1000000)
{
total = total-250000;
it = (int)(total*.2);
System.out.println("Income tax to be payed="+it);
}
else if(total<=1000000)
{
total = total-250000;
it=(int)(total*.3);
System.out.println("Income tax to be payed="+it);
}
}
}
2) WAP to calculate the multiplication of Complex numbers?
ReplyDeleteimport java.util.Scanner;
class Complexnum
{
public static void main(String args[])
{
int r,i,a,b,c,d;
Scanner sc = new Scanner(System.in);
System.out.println("Enter the first num:");
a = sc.nextInt();
System.out.println("Enter the second num:");
b = sc.nextInt();
System.out.println("Enter the third num:");
c = sc.nextInt();
System.out.println("Enter the fourth num:");
d = sc.nextInt();
r = a*c-b*d;
i = a*d+b*c;
System.out.println("real="+r);
System.out.println("image="+i+"1");
}
}
3) WAP to calculate the area of a triangle using heron's formula in java?
ReplyDeleteimport java.util.Scanner;
class Triherons
{
public static void main(String...args)
{
Scanner sc = new Scanner(System.in);
double area,s,a,b,c;
System.out.println("enter the number");
a = sc.nextDouble();
b = sc.nextDouble();
c = sc.nextDouble();
s = (a+b+c)/2;
area = Math.sqrt(s*(s-a)*(s-b)*(s-c));
System.out.println("area="+area);
}
}
4) WAP to calculate age where the son is 20 years younger than the father and 18 years younger than the mother what will be the age of the son, father, and mother, calculation start year will be entered by the user?
ReplyDeleteimport java.util.Scanner;
class Calculateage
{
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
int year,sonage,fatherage,motherage;
System.out.println("Enter the year");
year = sc.nextInt();
System.out.println("Enter the mother age");
motherage = sc.nextInt();
System.out.println("Enter the father age");
fatherage = sc.nextInt();
System.out.println("Enter the son age");
sonage = sc.nextInt();
sonage = 2020-year;
fatherage = sonage+20;
motherage = fatherage-2;
System.out.println("son's age is"+sonage);
System.out.println("Father's age"+fatherage);
System.out.println("Mother's age"+motherage);
}
}
Ankita Verma
ReplyDeleteclass Salary
{
public static void main(String args[])
{
int basic=20000;
int ta= 2000;
int da=2500;
int comm=30000;
int pf =2000;
int leave=4;
int gross,net,incometext;
gross=basic+ta+da+comm;
incometext=(gross/30)*leave;
net=gross-pf-incometext;
System.out.println("gross salary=" +gross);
System.out.println("net salary=" +net);
}
}
Ankita Verma
Deleteclass ComplexClass
{
public static void main(String args[])
{
int a,b,c,d,x,y,i=0;
a=6;
b=4;
c=5;
d=3;
x=a*c-b*d;
y=a*b+c*d;
System.out.println(x+ "+" +y +"i");
}
}
Ankita Verma
Deleteclass Heron
{
public static void main(String args[])
{
double s1=5,s2=8,s3=6,area,ar;
area=(s1+s2+s3)/2;
ar= (area* (area - s1) * (area - s2) * (area - s3));
System.out.println("area of triangle=" +ar);
}
}
Anjali Chouhan
ReplyDeleteimport java.util.Scanner;
class Herons1
{
public static void main(String args[])
{
Scanner sc= new Scanner(System.in);
double Area,sum1,a,b,c;
System.out.println("Enter Three Sides of a Triangle");
a=sc.nextDouble();
b=sc.nextDouble();
c=sc.nextDouble();
sum1=(a+b+c)/2;
Area=Math.sqrt(sum1*(sum1-a)*(sum1-b)*(sum1-c));
System.out.println("Area="+Area);
}
}
Anjali Chouhan
ReplyDeleteimport java.util.Scanner;
class Familyage
{
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
int year,sonage,fatherage,motherage;
System.out.println("Enter the year");
year = sc.nextInt();
System.out.println("Enter the mother age");
motherage = sc.nextInt();
System.out.println("Enter the father age");
fatherage = sc.nextInt();
System.out.println("Enter the son age");
sonage = sc.nextInt();
sonage = 2021-year;
fatherage = sonage+20;
motherage = fatherage-2;
System.out.println("Father's age"+fatherage);
System.out.println("Mother's age"+motherage);
System.out.println("son's age is"+sonage);
}
}
Anjali Chouhan
ReplyDeleteclass Salary
{
public static void main(String args[])
{
int bs=35000,ta=1500,da=2500,comm=45000,pf=2000,leave=2,gs,nets;
gs=bs+ta+da+comm;
System.out.println("Gross salary is ="+gs);
nets=gs-pf-(leave*150);
System.out.println("Net Salary is ="+nets);
}
}
//yogesh seroke
ReplyDeleteclass Gsalary
{
public static void main(String args[])
{
int bs=20000,ta=2000,da=2500,comm=30000,pf=2000,leave=6,gs,nets; //200₹ per day cut on leave
gs=bs+ta+da+comm;
System.out.println("Gross salary is :- "+gs);
nets=gs-pf-(leave*200);
System.out.println("Net Salary is :- "+nets);
}
}
//yogesh seroke
ReplyDeleteimport java.util.Scanner;
class Calculateage
{
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
int year,sonage,fatherage,motherage;
System.out.println("Enter the year");
year = sc.nextInt();
System.out.println("Enter the mother age");
motherage = sc.nextInt();
System.out.println("Enter the father age");
fatherage = sc.nextInt();
System.out.println("Enter the son age");
sonage = sc.nextInt();
sonage = 2020-year;
fatherage = sonage+20;
motherage = fatherage-2;
System.out.println("son's age is"+sonage);
System.out.println("Father's age"+fatherage);
System.out.println("Mother's age"+motherage);
}
}
Calculate net salary & gross salary
ReplyDeleteclass Salary
{
public static void main(String args[])
{
int basic, ta,da,comm,pf,leave;
basic = 20000;
ta = 2000;
da = 2500;
comm = 3000;
pf = 2000;
leave = 4;
int netsalary;
int grosssalary;
netsalary = basic + ta + da + comm + pf;
grosssalary = basic + ta + da + comm + pf - leave;
System.out.println("netsalary :" +netsalary);
System.out.println("grosssalary :" +grosssalary);
}
}
Calculate age where son is 20yr...
ReplyDeleteclass Age
{
public static void main(String args[])
{
int son,father,mother;
son = 20;
father = son + 20;
mother = son + 18;
System.out.println(father);
System.out.println(mother);
}
}
class EMN
ReplyDelete{
public static void main(String args[])
{
int Basic=20000,ta=2000,da=1000,comm=25000,pf=1500,leave=6;
int net_salary=Basic+ta+da+comm+pf;
int leave1=(net_salary/30)*(leave-2);
int gross_salary=Basic+ta+da+comm-pf-leave1;
System.out.println(net_salary);
System.out.println(gross_salary);
}
}
import java.util.Scanner;
ReplyDeleteclass Salary
{
public static void main(String []args)
{
Scanner sc=new Scanner(System.in);
int basicsal,ta,da,commition,pf, leaves,gross,netsalary,perdaysal;
System.out.println("Enter basic salary");
basicsal=sc.nextInt();
System.out.println("travelling allounce");
ta=sc.nextInt();
System.out.println("Enter daily allounce");
da=sc.nextInt();
System.out.println("Enter comition");
commition=sc.nextInt();
System.out.println("Enter pf");
pf=sc.nextInt();
System.out.println("Enter leaves");
leaves=sc.nextInt();
gross=basicsal+ta+da+commition+pf;
System.out.println("Gross salary is"+gross);
perdaysal=gross/30;
netsalary=gross-pf-(leaves*perdaysal);
System.out.println("Net salary is"+netsalary);
}
}