1// Computer.Java Ths is the Super class from whch laptops and Desktops will inherit the attributes of this class
2public abstract class ComputerObject {
3 //Here we declare all of the superclass variables that will be used by both Laptops and desktops
4 //These are attributes of all computers
5 private int usefulLife = 1;
6 private String stockCode = "XXXXXXXX";
7 private int purchasingCost = 10000;
8 private String staffNumber = "XXXXXXXX";
9 private String serialNumber = "ABCDEFG";
10 private String cpuType = "Multicore Parallel Threading";
11 private int ramAmount = 12;
12
13 /**Default construct Need only be present and we do not need any additional constructors except the one below*/
14 protected ComputerObject() { }
15
16 /**Construct a full Computer object. We receive all of the variable information and place them in the correct private variables using our mutators*/
17 /* we use mutators because validation is often done in mutators*/
18 protected ComputerObject(int usefulLife, String stockCode,int purchasingCost,String staffNumber,String serialNumber ,String cpuType, int ramAmount) {
19 setUsfulLife(usefulLife);
20 setPurchasingCost(purchasingCost);
21 setRamAmount(ramAmount);
22 setStockCode(stockCode);
23 setStaffNumber(staffNumber);
24 setCpuType(cpuType);
25 setSerialNumber(serialNumber);
26 }
27
28 /**Getter/Accessor method for usefulLife*/
29 public int getUsfulLife(){
30 return usefulLife;
31 }
32
33
34 /**Setter/Mutator method for usefulLife*/
35 public void setUsfulLife(int usefulLife){
36 this.usefulLife = usefulLife;
37 }
38 /**Getter/Accessor method for purchasingCost*/
39 public int getPurchasingCost(){
40 return purchasingCost;
41 }
42
43 /**Setter/Mutator method for purchasingCost*/
44 public void setPurchasingCost(int purchasingCost){
45 this.purchasingCost = purchasingCost;
46 }
47
48 /**Getter/Accessor method for ramAmount*/
49 public int getRamAmount(){
50 return ramAmount;
51 }
52
53 /**Setter/Mutator method for ramAmount*/
54 public void setRamAmount(int ramAmount){
55 this.ramAmount = ramAmount;
56 }
57
58
59 /**Getter/Accessor method for stockCode*/
60 public String getStockCode(){
61 return stockCode;
62 }
63
64 /**Setter/Mutator method for stockCode*/
65 public void setStockCode(String stockCode){
66 this.stockCode = stockCode;
67 }
68
69
70 /**Getter/Accessor method for staffNumber*/
71 public String getStaffNumber(){
72 return staffNumber;
73 }
74
75 /**Setter/Mutator method for staffNumber*/
76 public void setStaffNumber(String staffNumber){
77 this.staffNumber = staffNumber ;
78 }
79
80 /**Getter/Accessor method for cpuType*/
81 public String getCpuType(){
82 return cpuType;
83 }
84
85 /**Setter/Mutator method for cpuType*/
86 public void setCpuType(String cpuType){
87 this.cpuType = cpuType ;
88 }
89
90
91
92 /**Getter/Accessor method for serialNumber*/
93 public String getSerialNumber(){
94 return serialNumber;
95 }
96
97 /**Setter/Mutator method for serialNumber*/
98 public void setSerialNumber(String serialNumber){
99 this.serialNumber = serialNumber ;
100 }
101
102 /**Abstract method AnnualDepreciation*/
103 //The implimentations of this method can be found in the Laptop and Desktop sub classes
104 public abstract double AnnualDepreciation();
105}
106
107