UML Diagram
![UML Diagram to JAVA code [problem 3] 3 UML Diagram to JAVA code [problem 3] 3](https://old.nurnobishanto.com/wp-content/uploads/2019/10/Problem3_UML.jpg)
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
![UML Diagram to JAVA code [problem 3] 4 UML Diagram to JAVA code [problem 3] 4](https://old.nurnobishanto.com/wp-content/uploads/2019/10/Problem3_ouput.jpg)
- How to Use URI Online Judge to Improve Your Coding Skills and Boost Your Career
- 6 Ways to Monetize Your Blog and Earn Money Online
- Banglahour24.com | Bangla News
- BEST FREE GIFT CARD GENERATOR in 2022
- Gravity Forms Free Download GPL