Advertisement
Guest User

Untitled

a guest
Mar 31st, 2015
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. class Record {
  2. //instance vars go here
  3. public Record (String ord, String reg, String cus, String ite, int uni, double cos ) {
  4. Date date = new Date(ord);
  5. } //end constructor
  6.  
  7. public String recToString (boolean format) {
  8. if(format == true){
  9. return "" + getOrderDate(true) + "\t" + getRegion() + "\t" + getCustomer() + "\t" + getItem() + "\t" + getCost() + "\t" + getUnits() + "\t" + getTotal();
  10. }
  11. else{
  12. return "" + getOrderDate(false) + "\t" + getRegion() + "\t" + getCustomer() + "\t" + getItem() + "\t" + getCost() + "\t" + getUnits() + "\t" + getTotal();
  13. }
  14. } //end recToString
  15.  
  16. public String getOrderDate(boolean format) {
  17. if(format == true){
  18. return date.usFormat();
  19. }
  20. else{
  21. return date.euFormat();
  22. }
  23. } //end getOrderDate
  24.  
  25. public String getRegion() {
  26. return reg;
  27. } //end getRegion
  28.  
  29. public String getCustomer() {
  30. return cus;
  31. } //end getCustomer
  32.  
  33. public String getItem() {
  34. return ite;
  35. } //end getItem
  36.  
  37. public int getUnits() {
  38. return uni;
  39. } //end getUnits
  40.  
  41. public double getCost() {
  42. return cos;
  43. } //end getCost
  44.  
  45. public double getTotal() {
  46. return this.cos * this.uni;
  47. } //end getTotal
  48. } //end class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement