-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCheckMail.java
More file actions
84 lines (73 loc) · 1.88 KB
/
CheckMail.java
File metadata and controls
84 lines (73 loc) · 1.88 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/**
* Write a description of class CheckMail here.
*
* @author Luke Bradaric
* @version (a version number or a date)
*/
public class CheckMail
{
private float weight;
private float length;
private float width;
private float height;
public CheckMail(float w, float len, float wid, float hei)
{
weight = w;
length = len;
width = wid;
height = hei;
Test();
}
private void Test()
{
float largest = 0;
float dim2 = 0;
float dim3 = 0;
if (length > width)
{
if (length > height)
{
largest = length;
dim2 = width;
dim3 = height;
}
else if (length < height)
{
largest = height;
dim2 = length;
dim3 = width;
}
}
else if (width > length)
{
if (width > height)
{
largest = width;
dim2 = length;
dim3 = height;
}
else if (width < height)
{
largest = height;
dim2 = length;
dim3 = width;
}
}
if (largest + ((dim2 * 2) + (dim3 * 2)) > 100 && weight > 70)
{
System.out.println("Package is too large and too heavy.");
}
else if (weight > 70)
{
System.out.println("Package is too heavy.");
}
else if (largest + ((dim2 * 2) + (dim3 * 2)) > 100)
{
System.out.println("Package is too large.");
}
else
{
System.out.println("Package is acceptable.");
}
}
}