Skip to content

Commit bcd1202

Browse files
authored
The Class
1 parent 06ae81a commit bcd1202

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

maxmin/MaxMin.java

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package maxmin;
2+
3+
public class MaxMin
4+
{
5+
int x;
6+
int y;
7+
MaxMin(String a,String b) throws NumberFormatException
8+
{
9+
x = Integer.parseInt(a);
10+
y = Integer.parseInt(b);
11+
}
12+
13+
public int findMax() throws BothEqualException
14+
{
15+
if( x== y)
16+
throw new BothEqualException("Please enter unequal values : ");
17+
18+
if( x > y )
19+
return x;
20+
else
21+
return y;
22+
}
23+
24+
public int findMin() throws BothEqualException
25+
{
26+
if( x== y)
27+
throw new BothEqualException("Please enter unequal values : ");
28+
29+
if( x < y )
30+
return x;
31+
else
32+
return y;
33+
}
34+
}

0 commit comments

Comments
 (0)