Layered Architecture in Hospital System

This program demonstrates layered architecture in hospital system.

Problem Statement

Write a Java program with Data, Service, and Presentation layers for patient info.

Source Code

1 class DataLayer {
2 String getPatient(){ return "Patient: Arun"; }
3 }
4 class ServiceLayer {
5 DataLayer dl=new DataLayer();
6 String process(){ return "Processed "+dl.getPatient(); }
7 }
8 class PresentationLayer {
9 ServiceLayer sl=new ServiceLayer();
10 void show(){ System.out.println(sl.process()); }
11 }
12 public class LayeredHospital {
13 public static void main(String[] args) {
14 System.out.println("Eduinq Layered Hospital System");
15 PresentationLayer pl=new PresentationLayer();
16 pl.show();
17 }
18 }

Program Output

Eduinq Layered Hospital System
Processed Patient: Arun

Explanation

Data layer fetches patient info. - Service layer processes data. - Presentation layer displays result. - This models layered architecture in hospital case study. Conclusion: Shows layered architecture in hospital system.

Quick Links to Explore