1 57 58 package shop; 59 60 64 public class Item implements Cloneable , java.io.Serializable 65 { 66 private java.lang.String fieldNumber; 67 private java.lang.String fieldName; 68 private int fieldQuantity; 69 private long fieldPrice; 70 73 public Item() { 74 super(); 75 } 76 79 public Item(String itemNumber, String itemName, int itemQuantity) 80 { 81 super(); 82 fieldNumber = itemNumber ; 83 fieldName = itemName ; 84 fieldQuantity = itemQuantity ; 85 } 86 public Object clone() 87 { 88 Object obj = null ; 89 try 90 { 91 obj = super.clone() ; 92 } 93 catch(CloneNotSupportedException ex) 94 { 95 } 97 return obj ; 98 } 99 103 public java.lang.String getName() { 104 return fieldName; 105 } 106 110 public java.lang.String getNumber() { 111 return fieldNumber; 112 } 113 117 public long getPrice() { 118 return fieldPrice; 119 } 120 124 public int getQuantity() { 125 return fieldQuantity; 126 } 127 131 public void setName(java.lang.String newName) { 132 fieldName = newName; 133 } 134 138 public void setNumber(java.lang.String newNumber) { 139 fieldNumber = newNumber; 140 } 141 145 public void setPrice(long newPrice) { 146 fieldPrice = newPrice; 147 } 148 152 public void setQuantity(int newQuantity) { 153 fieldQuantity = newQuantity; 154 } 155 public String toString() 156 { 157 return super.toString() + 158 "\nname = " + fieldName + 159 "\nnumber = " + fieldNumber + 160 "\nprice = " + fieldPrice + 161 "\nquantity = " + fieldQuantity ; 162 163 } 164 } 165 | Popular Tags |