Layered Architecture in E Commerce
This program demonstrates layered architecture in e commerce system.
Problem Statement
Write a Java program with Data, Service, and Presentation layers for product display.
Source Code
| 1 | class DataLayer { |
| 2 | String getProduct(){ return "Laptop"; } |
| 3 | } |
| 4 | class ServiceLayer { |
| 5 | DataLayer dl=new DataLayer(); |
| 6 | String process(){ return "Product: "+dl.getProduct(); } |
| 7 | } |
| 8 | class PresentationLayer { |
| 9 | ServiceLayer sl=new ServiceLayer(); |
| 10 | void show(){ System.out.println(sl.process()); } |
| 11 | } |
| 12 | public class LayeredEcommerce { |
| 13 | public static void main(String[] args) { |
| 14 | System.out.println("Eduinq Layered E Commerce"); |
| 15 | PresentationLayer pl=new PresentationLayer(); |
| 16 | pl.show(); |
| 17 | } |
| 18 | } |
Program Output
Eduinq Layered E Commerce Product: Laptop
Explanation
Data layer fetches product. - Service layer processes data. - Presentation layer displays result. - This models layered architecture in enterprise systems. Conclusion: Shows layered architecture in e commerce case study.