-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmaxofthree.java
More file actions
41 lines (39 loc) · 1 KB
/
Copy pathmaxofthree.java
File metadata and controls
41 lines (39 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import java.util.Scanner;
public class maxofthree{
@SuppressWarnings("unused")
private int a;
@SuppressWarnings("unused")
private int b;
@SuppressWarnings("unused")
private int c;
public maxofthree(int n1,int n2, int n3)
{
this.a=n1;
this.b=n2;
this.c=n2;
}
public void findmax(int n1,int n2,int n3)
{
if(n1>n2&&n1>n3)
{
System.out.println("the Maximum of the three: " + n1);
}
else if(n2>n3&&n2>n3)
{
System.out.println("The moaximum of the three: " + n2);
}
else{
System.out.println("The maximum of the three: " + n3);
}
}
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
int a = in.nextInt();
int b = in.nextInt();
int c = in.nextInt();
maxofthree max = new maxofthree(a, b, c);
max.findmax(a,b,c);
in.close();
}
}