Java, .NET, PHP, PYTHON, ANGULAR, ML, Data Science, Testing, CI Tutorials in Easy Languages.

"Best Software Training, Internship, Project Development center of Indore India, Helpline 780506-3968"


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?

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



20 Comments

If you have any doubt in programming or join online classes then you can contact us by comment .

  1. import java.util.Scanner;
    class 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);
    }

    }

    }

    ReplyDelete
  2. class Salary
    {
    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);
    }
    }

    ReplyDelete
  3. 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.
    Sol:
    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);
    }
    }

    ReplyDelete
  4. Q: WAP to calculate the area of a triangle using heron's formula in java?
    Sol:
    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);
    }
    }

    ReplyDelete
  5. 1 WAP to create a Salary Calculator of an employee using basic, ta, da, comm, pf, number of leave.

    class 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);

    }

    }

    ReplyDelete
  6. 1 WAP to create a Salary Calculator of an employee using basic, ta, da, comm, pf, number of leave.

    class 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);
    }

    }

    ReplyDelete
  7. class Slipay
    {
    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);
    }

    }

    ReplyDelete
  8. 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



    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);
    }

    }

    ReplyDelete
  9. WAP to calculate the area of a triangle using heron's formula in java


    class 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);
    }
    }

    ReplyDelete
  10. Q:- WAP to calculate the area of a triangle using heron's formula in java ??
    Solution:-
    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);
    }
    }

    ReplyDelete
  11. WAP to calculate the multiplication of Complex number

    class 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");

    }
    }

    ReplyDelete
  12. I have doubt in this question

    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

    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);
    }
    }

    ReplyDelete
  13. class Salary
    {
    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);
    }
    }

    ReplyDelete
  14. class DisplayAge
    {
    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);



    }



    }

    ReplyDelete
  15. Solution of Complex Number Multiplication:-

    class 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");
    }

    }

    ReplyDelete
  16. class salary
    {
    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);
    }
    }

    ReplyDelete
  17. class multi
    {
    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);

    }
    }

    ReplyDelete
  18. class heron
    {
    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);
    }
    }

    ReplyDelete
  19. / WAP to calculate the area of a triangle using heron's formula in java?
    import 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);
    }

    }

    ReplyDelete
  20. Solution by Shiva Concept For Salary Calculator Program

    package 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);




    }

    }

    ReplyDelete

Post a Comment

If you have any doubt in programming or join online classes then you can contact us by comment .

Previous Post Next Post