-
Notifications
You must be signed in to change notification settings - Fork 0
/
Envelope.java
72 lines (62 loc) · 1.71 KB
/
Envelope.java
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
package assign5_tac91;
import static java.lang.System.out;
import java.util.*;
/**
* Subclass of Package Superclass
* @author Taylor Carr
*/
public class Envelope extends Package {
private int height;
private int width;
/**
* Constructor used to initialize the class fields of the class with the
* provided values.
* @param ptn
* @param specification
* @param mailingClass
* @param height
* @param width
*/
public Envelope(String ptn, String specification, String mailingClass, Integer height, Integer width) {
super(ptn, specification, mailingClass);
this.height = height;
this.width = width;
}
/**
* Adds Envelope object to Package ArrayList
*/
public void newEnvelope(){
// Package newEnvelope = new Package();
out.println("Enter Envelope Information:");
out.println("Tracking Number, Specificaition, Mailing Class, Height & Width");
Scanner cin = new Scanner(System.in);
String input = cin.nextLine();
String[] words = input.split(" ");
if (words.length != 5){
out.println();
out.println("Invalid number of fields");
out.println();
}
else {
this.setTrackingNumber(words[0]);
this.setSpec(words[1]);
this.setMC(words[2]);
this.height = Integer.parseInt(words[3]);
this.width = Integer.parseInt(words[4]);
}
}
/**
*
* @return height
*/
public int getHeight(){
return height;
}
/**
*
* @return width
*/
public int getWidth(){
return width;
}
}