Skip to content

Commit 6ed423b

Browse files
author
Adiganesh005
committed
added new files
1 parent 2b03f17 commit 6ed423b

12 files changed

+167
-0
lines changed

bin/Calculator1.class

384 Bytes
Binary file not shown.

bin/Calculator2.class

1.35 KB
Binary file not shown.

bin/Child.class

230 Bytes
Binary file not shown.

bin/Main.class

815 Bytes
Binary file not shown.

bin/Parent.class

888 Bytes
Binary file not shown.

bin/PerfectSquares.class

915 Bytes
Binary file not shown.

src/Calculator1.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
public class Calculator1 {
3+
public int sum(int a, int b){
4+
int c;
5+
c = a+b;
6+
return c;
7+
}
8+
9+
}

src/Calculator2.java

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
2+
public class Calculator2 extends Calculator1 {
3+
public int sum3(int a, int b, int c){
4+
5+
int d, e;
6+
d = sum(a,b);
7+
e = sum(d,c);
8+
return e;
9+
10+
}
11+
public int sum4(int a, int b, int c, int x){
12+
13+
int d, e;
14+
d = sum(a,b);
15+
e = sum(d,c);
16+
d = 0;
17+
d = sum(e,x);
18+
return d;
19+
20+
}
21+
public int sum5(int a, int b, int c, int x, int y){
22+
23+
int d, e;
24+
d = sum(a,b);
25+
e = sum(d,c);
26+
d = 0;
27+
d = sum(e,x);
28+
e = 0;
29+
e = sum(d,y);
30+
return e;
31+
32+
}
33+
public int sum6(int a, int b, int c, int x, int y, int z){
34+
35+
int d, e;
36+
d = sum(a,b);
37+
e = sum(d,c);
38+
d = 0;
39+
d = sum(e,x);
40+
e = 0;
41+
e = sum(d,y);
42+
43+
d = 0;
44+
d = sum(e,z);
45+
return d;
46+
47+
}
48+
public int sum7(int a, int b, int c, int x, int y, int z, int f){
49+
50+
int d, e;
51+
d = sum(a,b);
52+
e = sum(d,c);
53+
d = 0;
54+
d = sum(e,x);
55+
e = 0;
56+
e = sum(d,y);
57+
58+
d = 0;
59+
d = sum(e,z);
60+
e = 0;
61+
e = sum(d,f);
62+
return e;
63+
64+
}
65+
66+
}

src/Child.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
public class Child extends Parent{
3+
4+
5+
6+
7+
8+
}

src/Main.java

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
2+
public class Main {
3+
4+
public static void main(String[] args) {
5+
// TODO Auto-generated method stub
6+
7+
/*Parent p = new Parent();
8+
Child c = new Child();
9+
c.FirstName = "Aditya";
10+
p.LastName = "Maduri";
11+
p.FirstName = "Shankar";
12+
c.PbankBalance = 500;
13+
p.PbankBalance = 1000;
14+
15+
System.out.println(c.PbankBalance + p.PbankBalance);
16+
System.out.println(c.FirstName + p.LastName);
17+
18+
System.out.println(c.FirstName);
19+
System.out.println(p.FirstName);
20+
21+
p.getFirstName();
22+
*/
23+
24+
Calculator2 c2 = new Calculator2();
25+
System.out.println(c2.sum(4, 5));
26+
System.out.println(c2.sum3(4, 5, 6));
27+
System.out.println(c2.sum4(4, 5, 6, 3));
28+
System.out.println(c2.sum5(4, 5, 6, 3, 2));
29+
System.out.println(c2.sum6(4, 5, 6, 3, 2, 1));
30+
System.out.println(c2.sum7(4, 5, 6, 3, 2, 1, 9));
31+
32+
33+
34+
35+
}
36+
37+
}

0 commit comments

Comments
 (0)