0% found this document useful (0 votes)
4 views6 pages

Program Days

The document contains multiple Java programs that perform various calculations. The first program converts days into years, months, and remaining days. Other programs calculate the sum and average of three numbers, compute employee salary components, and determine the area and perimeter of a square based on its diagonal.

Uploaded by

everlovingmansi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views6 pages

Program Days

The document contains multiple Java programs that perform various calculations. The first program converts days into years, months, and remaining days. Other programs calculate the sum and average of three numbers, compute employee salary components, and determine the area and perimeter of a square based on its diagonal.

Uploaded by

everlovingmansi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Program Days

import java.util.Scanner;
public class Days
{
public static void main(String args[])
{
Scanner in = new Scanner(System.in);
int a,b,c,y,d;
System.out.println(" Enter the number of days: ");
a=in.nextInt();
y=a/365;
b=a%365;
c=b/30;
d=b%30;
System.out.println(" Number of years= "+y);
System.out.println(" Number of months= "+c);
System.out.println(" Number of days ="+d);

}
}
Output
Enter the number of days:
56
Number of years= 0
Number of months= 1
Number of days =26
Program Arithematic_Operators
public class Arithematic_Operator
{
public static void main(int a, int b, int c)
{
int d;
System.out.println(" The sum of 3 digit number is: ");
d=a+b+c;
System.out.println(d);

}
}
Output
The sum of 3 digit number is:
2024
Program Sum_Average
public class Sum_Average
{
public static void main(int a, int b, int c)
{
int d;
d=a+b+c;
System.out.println(" The sum is: "+d);
double Avg = d/3;
System.out.println(" The average is: " +Avg);
}
}
Output
The sum is: 107
The average is: 35.0
Program Employee

import java.util.Scanner;

public class Employee

public static void main(String args[])

Scanner in = new Scanner(System.in);

int basic;

System.out.println(" Enter the basic:" );

basic=in.nextInt();

double DA;

DA=basic*30/100;

System.out.println(" The value of DA is "+DA);

double HRA;

HRA=basic*15/100;

System.out.println(" The value of HRA is "+HRA);

double PF;

PF=basic*12.5/100;

System.out.println(" The value of PF is " +PF);

double Gross_pay;

Gross_pay=basic+DA+HRA;

System.out.println(" The Gross_pay is:" +Gross_pay);

double Net_pay;

Net_pay=Gross_pay-PF;

System.out.println(" The Net_pay is:" +Net_pay);

Output

Enter the basic:

78

The value of DA is 23.0


The value of HRA is 11.0

The value of PF is 9.75

The Gross_pay is:112.0

The Net_pay is:102.25


Program Diagonal

import java.util.Scanner;

public class Diagonal

public static void main(String argd[])

Scanner in = new Scanner(System.in);

double a,b,d,s;

System.out.println(" Enter the diagonal of a square: ");

d=in.nextInt();

s=in.nextInt();

a = s*s;

b = 4*s;

double diagonal=d/Math.sqrt(2);

System.out.println(" The perimeter is:= "+ b );

System.out.println(" The area is= "+ a );

Output

Enter the diagonal of a square:

The perimeter is:= 32.0

The area is= 64.0

You might also like