{"id":23922530,"url":"https://github.com/prakash-aryan/swalabfive","last_synced_at":"2025-11-17T11:01:09.373Z","repository":{"id":267092015,"uuid":"900242842","full_name":"prakash-aryan/swalabfive","owner":"prakash-aryan","description":"Design and implement a program that models a computer architecture using Composite and Visitor design patterns.","archived":false,"fork":false,"pushed_at":"2024-12-08T09:07:21.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-23T22:27:59.193Z","etag":null,"topics":["composite-pattern","csharp","rider","software-architecture","visitor-pattern"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/prakash-aryan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-08T09:04:45.000Z","updated_at":"2024-12-08T09:08:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"1d5b7d9d-6f30-4a0d-9e73-ff9836d29848","html_url":"https://github.com/prakash-aryan/swalabfive","commit_stats":null,"previous_names":["prakash-aryan/swalabfive"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/prakash-aryan/swalabfive","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prakash-aryan%2Fswalabfive","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prakash-aryan%2Fswalabfive/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prakash-aryan%2Fswalabfive/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prakash-aryan%2Fswalabfive/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/prakash-aryan","download_url":"https://codeload.github.com/prakash-aryan/swalabfive/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prakash-aryan%2Fswalabfive/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":284868712,"owners_count":27076420,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-11-17T02:00:06.431Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["composite-pattern","csharp","rider","software-architecture","visitor-pattern"],"created_at":"2025-01-05T17:14:39.290Z","updated_at":"2025-11-17T11:01:09.359Z","avatar_url":"https://github.com/prakash-aryan.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Computer Architecture Price Calculator\n\n## Problem Statement\nDesign and implement a program that models a computer architecture using Composite and Visitor design patterns. The computer consists of various components:\n\n### Component Structure\n- Computer\n  - CPU\n  - KEYBOARD\n  - MEMORY\n    - RAM\n    - ROM\n    - EXTERNAL DISK\n  - MONITOR\n  - GRAPHIC CARD\n    - GPU\n    - GRAPHIC MEMORY\n\n### Requirements\n1. Use composite pattern to model the computer architecture\n2. Implement visitor pattern to calculate the price of memory components only (RAM, ROM, EXTERNAL DISK)\n3. Other component prices can be ignored in the final calculation\n\n### Test Data (Prices in AED)\n- KEYBOARD: 60\n- CPU: 400\n- MONITOR: 120\n- GPU: 200\n- GRAPHIC MEMORY: 100\n- RAM: 140\n- ROM: 90\n- EXTERNAL DISK: 150\n\n## Solution Architecture\n\n```mermaid\nclassDiagram\n    IComputerComponent \u003c|-- CompositeComponent\n    IComputerComponent \u003c|-- LeafComponent\n    CompositeComponent \u003c|-- Computer\n    CompositeComponent \u003c|-- Memory\n    CompositeComponent \u003c|-- GraphicCard\n    LeafComponent \u003c|-- Cpu\n    LeafComponent \u003c|-- Keyboard\n    LeafComponent \u003c|-- Monitor\n    LeafComponent \u003c|-- Ram\n    LeafComponent \u003c|-- Rom\n    LeafComponent \u003c|-- ExternalDisk\n    LeafComponent \u003c|-- Gpu\n    LeafComponent \u003c|-- GraphicMemory\n    \n    class IComputerComponent {\n        \u003c\u003cinterface\u003e\u003e\n        +Accept(visitor)\n        +GetPrice()\n        +GetName()\n    }\n    \n    class CompositeComponent {\n        \u003c\u003cabstract\u003e\u003e\n        #children: List\n        +Add(component)\n        +GetPrice()\n    }\n    \n    class IComputerVisitor {\n        \u003c\u003cinterface\u003e\u003e\n        +VisitMemory()\n        +VisitRam()\n        +VisitRom()\n        +VisitExternalDisk()\n        +VisitCpu()\n        +VisitKeyboard()\n        +VisitMonitor()\n        +VisitGraphicCard()\n        +VisitGpu()\n        +VisitGraphicMemory()\n    }\n```\n\n## Implementation Details\n\n### Design Patterns Used\n1. **Composite Pattern**\n   - Allows treating individual components and composite components uniformly\n   - Implements tree structure for computer components\n   - Components share common interface `IComputerComponent`\n\n2. **Visitor Pattern**\n   - Separates algorithms from object structure\n   - `MemoryPriceVisitor` calculates prices of memory components\n   - Allows adding new operations without modifying component classes\n\n### Key Components\n- `IComputerComponent`: Base interface for all components\n- `CompositeComponent`: Abstract class for components that can contain other components\n- `LeafComponent`: Base class for atomic components\n- `IComputerVisitor`: Interface for visitor pattern implementation\n- `MemoryPriceVisitor`: Concrete visitor that calculates memory prices\n\n### Output\nThe program displays:\n```\nComputer Architecture Price Calculator\n=====================================\nMemory Components Prices:\n------------------------\nRAM: 140 AED\nROM: 90 AED\nExternal Disk: 150 AED\n\nTotal price of memory components: 380 AED\n```\n\n## How to Run\n1. Clone the repository\n2. Open the solution in Visual Studio or JetBrains Rider\n3. Build and run the project\n\n## Requirements\n- .NET 9.0 or later\n- C# development environment (Visual Studio/Rider)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprakash-aryan%2Fswalabfive","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprakash-aryan%2Fswalabfive","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprakash-aryan%2Fswalabfive/lists"}