Table of Contents

62
Story to UML to Java Source Code - 1
UML Diagram

DOWNLOAD SOURCE CODE

Main Class source code


public class Main {

	public static void main(String[]args)
	{
		Agora agora= new Agora ("Dhanmondi","Sukrabad","Agora Wow","017****");
		Item itm = new Item(101,"Buble",120.25);
		Outlet ol  = new Outlet(agora,itm);
		Customer c = new Customer("122","Rahim");
		Buy buy= new Buy("12/12/2020",1,itm,c);
		buy.display();
		
		ol.display();
		
		
		
	}
}

Agora Class source code


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:"+cell);
	}
}

Shop Class source code


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("Locattio ="+location + "\n"+ "Address = "+ address);
		
	}

}

Item Class source code


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+"\n"+"Item Name:"+name+"\n"+"Price: "+price);
	}
}

Customer Class source code


public class Customer {

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

Buy class source code


public class Buy {

	private String date;
	private int qty;
	Item item;
	Customer customer;
	

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

Outlet class source code


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();
	}
}

Agora is Shop .Every Shop has location and address .Agora ha outlet number and cell number.Customer buy Item from Agora. Customer has customer id and name.Item has item Id and unit price.Customer buy item as a specific date quantity.

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
1 Comment
Most Voted
Newest Oldest
Inline Feedbacks
View all comments
oprolevorter
oprolevorter
December 11, 2019 5:12 AM

Wow, fantastic weblog layout! How lengthy have you been running a blog for? you make running a blog glance easy. The whole look of your website is wonderful, as neatly as the content material!

1
0
Would love your thoughts, please comment.x
()
x