Table of Contents

58

UML Diagram

Main Class java code

package ARP;

public class Main {
	public static void main(String[] args)
	{
		Agora agr = new Agora("Dhanmondi","Sukrabad","Adi sukrabad","017*****");
		Item itm = new Item(10,"Kacchi",130.0);
		Customer cr =new Customer("15","Kamal");
		Outlet ot= new Outlet(agr,itm);
		Buy buy = new Buy(cr,itm,"1 November 2019",1);
		ot.display();
		buy.display();
		
	}

}

Customer class Java code

package ARP;

public class Customer {
	
	private String cusId;
	private String name;

	public Customer (String cusId,String name)
	{
		this.cusId=cusId;
		this.name=name;
	}
	public void display()
	{
		System.out.println("Customer ID:"+cusId);
		System.out.println("Customer Name:"+name);
	}
}

Buy class java code

package ARP;

public class Buy {

	private String date;
	private int qty;
	
	Customer customer;
	Item item;
	
	public Buy(Customer customer,Item item,String date,int qty)
	{
		this.customer=customer;
		this.item=item;
		this.date=date;
		this.qty=qty;
	}
	public void display()
	{
		customer.display();
		item.display();
		System.out.println("Date :"+date);
		System.out.println("Quantity :"+qty);
	}
}

Outlet class java code

package ARP;

public class Outlet {
	Agora agora;
	Item item;
	
	public Outlet(Agora agora,Item item)
	{
		this.agora=agora;
		this.item=item;
	}
	public void display()
	{
		agora.display();
		item.display();
	}

}

Item Class java code

package ARP;

public class Item {
	private int itemId;
	private String name;
	private double price;

	public Item(int itemId,String name,double price)
	{
		this.itemId=itemId;
		this.name=name;
		this.price=price;
	}
	public void display()
	{
		System.out.println("Item ID: "+itemId);
        System.out.println("Item Name :"+name);
        System.out.println("Price :"+price);
		
	}
}

Shop class java code

package ARP;


public class Shop {

	protected String location;
	protected String address;
	public Shop(String location,String address)

		{
			this.location=location;
			this.address=address;
	    }
	
	public void display()
	{
		System.out.println("Location :"+location+"\n"+"Address :"+address);
		
	}
	
}

Agora class java code

package ARP;

public class Agora extends Shop {
	private String outlet;
	private String cell;
	
	public Agora(String location,String address,String outlet,String cell)
	{
		super(location,address);
		this.outlet=outlet;
		this.cell=cell;
	}
	public void display()
	{
		super.display();
		System.out.println("Outlet :"+outlet+"\n"+cell);
	}

}

Output

Output
Share on facebook
Facebook
Share on twitter
Twitter
Share on linkedin
LinkedIn
Share on pinterest
Pinterest
Share on whatsapp
WhatsApp
Share on email
Email
Md. Nurnobi Hosen
Md. Nurnobi Hosen

Student of Computer Science and Engineering at Daffodil International University,Main Campus ,Dhanmondi.
Web and App Developer also expart of wordpress customization

All Blog Posts »
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x