Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Customer::
- public class Customer {
- private String custID;
- private String name;
- private String cell;
- public Customer(String custID, String name, String cell) {
- this.custID = custID;
- this.name = name;
- this.cell = cell;
- }
- public void display() {
- System.out.println(custID + " "+ name +" " +cell);
- }
- }
- Item::
- public class Item {
- private String ItemID;
- private String name;
- private double price;;
- public Item (String ItemID,String Name,double price) {
- this.ItemID=ItemID;
- this.name=name;
- this.price=price;
- }
- public void display() {
- System.out.println(ItemID + " " + price);
- }
- }
- Buy::
- public class Buy {
- private Customer c;
- private Item i;
- private String date;
- private double quantity;
- public Buy(Customer c,Item i,String date,double quantity) {
- this.c=c;
- this.i=i;
- this.date =date;
- this.quantity =quantity;
- }
- public void display() {
- c.display();
- i.display();
- System.out.println(date + " "+quantity);
- }
- public static void main(String[] args) {
- Customer customer = new Customer ("394", "Bristy", "01930400");
- Item item = new Item("001", "OOP",250);
- Buy buy =new Buy (customer,item,"02-05-19", 230);
- buy.display();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement