Skip to content

Commit f039174

Browse files
committed
Initial commit
0 parents  commit f039174

226 files changed

Lines changed: 3688 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto

.idea/.gitignore

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations.xml

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/uiDesigner.xml

Lines changed: 124 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Child.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
class Parent {
2+
public static void staticMethod() {
3+
System.out.println("Parent: inside staticMethod");
4+
}
5+
}
6+
public class Child extends Parent {
7+
//overriding the static method
8+
public static void staticMethod() {
9+
System.out.println("Child: inside staticMethod");
10+
}
11+
12+
public static void main(String []args) {
13+
14+
Parent ParentWithParent = new Parent();
15+
Parent ParentWithChild = new Child();
16+
Child ChildWithChild = new Child();
17+
18+
ParentWithParent.staticMethod();
19+
ParentWithChild.staticMethod();
20+
ChildWithChild.staticMethod();
21+
22+
}
23+
}

EmployeeTest.java

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
import java.util.*;
2+
3+
class Employee{
4+
5+
6+
String first_name,last_name;
7+
double monthlysalary,yearlysalary;
8+
9+
Employee(){
10+
first_name = "";
11+
last_name = "";
12+
monthlysalary = 0.0;
13+
yearlysalary = 0.0;
14+
}
15+
16+
17+
void setFirstName(String first_name){
18+
this.first_name = first_name;
19+
}
20+
void setLastName(String last_name){
21+
this.last_name = last_name;
22+
}
23+
24+
void setMonthlySalary(double salary){
25+
if(salary<0){
26+
this.monthlysalary = 0.0;
27+
}
28+
else{
29+
this.monthlysalary = salary;
30+
}
31+
}
32+
33+
void setYearlySalary(double yearlysalary){
34+
this.yearlysalary = yearlysalary;
35+
}
36+
37+
38+
String getFirstName(){
39+
return first_name;
40+
}
41+
42+
String getLastName(){
43+
return last_name;
44+
}
45+
46+
String getFullName(){
47+
return (first_name + " "+last_name);
48+
}
49+
50+
double getMonthlySalary(){
51+
return monthlysalary;
52+
}
53+
54+
double getYearlySalary(){
55+
return yearlysalary;
56+
}
57+
}
58+
59+
class Employee_Test{
60+
61+
62+
public static void main(String[] args) {
63+
Scanner sc = new Scanner(System.in);
64+
65+
66+
Employee employee_1 = new Employee();
67+
Employee employee_2 = new Employee();
68+
69+
70+
System.out.println("-:Enter First Employee Details:- ");
71+
System.out.print("Enter First Name:- ");
72+
String first_name = sc.next();
73+
System.out.print("Enter Last Name:- ");
74+
String last_name = sc.next();
75+
System.out.print("Monthly Salary:- ");
76+
double salary = sc.nextDouble();
77+
78+
employee_1.setFirstName(first_name);
79+
employee_1.setLastName(last_name);
80+
employee_1.setMonthlySalary(salary);
81+
82+
System.out.println("-:Enter Second Employee Details:- ");
83+
System.out.print("Enter First Name:- ");
84+
String first_name1 = sc.next();
85+
System.out.print("Enter Last Name:- ");
86+
String last_name1 = sc.next();
87+
System.out.print("Monthly Salary:- ");
88+
double salary1 = sc.nextDouble();
89+
90+
employee_2.setFirstName(first_name1);
91+
employee_2.setLastName(last_name1);
92+
employee_2.setMonthlySalary(salary1);
93+
94+
95+
System.out.println("-:Details of Employees:-");
96+
System.out.println("Employee 1: ");
97+
System.out.println("Full Name:- "+employee_1.getFullName());
98+
System.out.println("Monthly Salary:- "+employee_1.getMonthlySalary());
99+
100+
101+
System.out.println("-------------------------------");
102+
System.out.println("Employee 1: ");
103+
System.out.println("Full Name:- "+employee_2.getFullName());
104+
System.out.println("Monthly Salary:- "+employee_2.getMonthlySalary());
105+
106+
System.out.println("-------------------------------");
107+
System.out.println("-:Employees Yearly Salary After 10% Increment");
108+
109+
110+
111+
double e1_ten_p = (employee_1.getMonthlySalary()) * 0.10;
112+
employee_1.setMonthlySalary(employee_1.getMonthlySalary()+e1_ten_p);
113+
double yearlysalary1 = (employee_1.getMonthlySalary()*12);
114+
employee_1.setYearlySalary(yearlysalary1);
115+
116+
117+
double e2_ten_p = (employee_2.getMonthlySalary()) * 0.10;
118+
employee_2.setMonthlySalary(employee_2.getMonthlySalary()+e2_ten_p);
119+
double yearlysalary2 = (employee_2.getMonthlySalary()*12);
120+
employee_2.setYearlySalary(yearlysalary2);
121+
122+
123+
124+
System.out.println("Employee 1:- ");
125+
System.out.println("Full Name:- "+employee_1.getFullName());
126+
System.out.println("Monthly Salary: "+employee_1.getMonthlySalary());
127+
System.out.println("Yearly Salary:- "+employee_1.getYearlySalary());
128+
129+
System.out.println("Employee 2:- ");
130+
System.out.println("Full Name:- "+employee_2.getFullName());
131+
System.out.println("Monthly Salary: "+employee_2.getMonthlySalary());
132+
System.out.println("Yearly Salary:- "+employee_2.getYearlySalary());
133+
134+
}
135+
}

HR_Static_initilaizer_block.java

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import java.io.*;
2+
import java.util.*;
3+
4+
public class HR_Static_initilaizer_block {
5+
static Scanner sc = new Scanner(System.in);
6+
static int B = sc.nextInt();
7+
static int H = sc.nextInt();
8+
9+
static boolean flag = initializerblock();
10+
static boolean initializerblock()
11+
{
12+
if(B <= 0 || H <= 0)
13+
{
14+
System.out.println("java.lang.Exception: Breadth and height must be positive" );
15+
flag = false;
16+
}
17+
else
18+
{
19+
flag = true;
20+
}
21+
return flag;
22+
}
23+
public static void main(String[] args) {
24+
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
25+
int area = 0;
26+
if(flag)
27+
{
28+
area = B * H;
29+
System.out.println(area);
30+
31+
}
32+
}
33+
}

0 commit comments

Comments
 (0)