Advertisement
Antora

Java project

May 20th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.23 KB | None | 0 0
  1. Customer::
  2.  
  3. public class Customer {
  4. private String custID;
  5. private String name;
  6. private String cell;
  7.  
  8.  
  9.  
  10. public Customer(String custID, String name, String cell) {
  11.     this.custID = custID;
  12.     this.name = name;
  13.     this.cell = cell;
  14. }
  15.  
  16.  
  17.  
  18. public void display()             {
  19.     System.out.println(custID + " "+ name +"  " +cell);
  20. }
  21.  
  22. }
  23.  
  24.  
  25. Item::
  26.  
  27. public class Item {
  28.     private String ItemID;
  29. private String name;
  30. private  double price;;
  31.  
  32. public Item (String ItemID,String Name,double price) {
  33.     this.ItemID=ItemID;
  34.             this.name=name;
  35.     this.price=price;
  36. }
  37. public void display()  {
  38.     System.out.println(ItemID + "  " + price);
  39. }
  40. }
  41. Buy::
  42.  
  43. public class Buy {
  44.     private Customer  c;
  45.     private Item i;
  46.     private String date;
  47.     private double quantity;
  48.     public Buy(Customer c,Item i,String date,double quantity) {
  49.         this.c=c;
  50.         this.i=i;
  51.         this.date =date;
  52.         this.quantity =quantity;
  53.     }
  54.     public void display() {
  55.         c.display();
  56.         i.display();
  57.         System.out.println(date + " "+quantity);
  58.     }
  59.  
  60.     public static void main(String[] args) {
  61.         Customer customer = new Customer ("394", "Bristy", "01930400");
  62.         Item item = new Item("001", "OOP",250);
  63.         Buy buy =new Buy (customer,item,"02-05-19", 230);
  64.         buy.display();
  65.    
  66.     }
  67.  
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement