0% found this document useful (0 votes)
1 views4 pages

Week 2 Assignment Java

The document outlines the design requirements for a ride-hailing system and a food delivery system, detailing functional requirements, constraints, and technical expectations related to object-oriented programming concepts. Both systems require state management for rides and orders, payment processing, and the assignment of available drivers or delivery partners. The design should emphasize clean code principles, scalability, and maintainability while utilizing appropriate design patterns.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views4 pages

Week 2 Assignment Java

The document outlines the design requirements for a ride-hailing system and a food delivery system, detailing functional requirements, constraints, and technical expectations related to object-oriented programming concepts. Both systems require state management for rides and orders, payment processing, and the assignment of available drivers or delivery partners. The design should emphasize clean code principles, scalability, and maintainability while utilizing appropriate design patterns.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Java Week 2 Assignment

1. Design a ride-hailing system with the following requirements:


Functional Requirements
1. Riders should be able to request a ride by providing pickup and drop
locations.
2. The system should assign the nearest available driver to the ride.
3. A driver can either accept or reject a ride request.
4. If a driver rejects the request, the system should assign another
available driver.
5. The ride should go through different states:
o REQUESTED
o DRIVER_ASSIGNED
o ACCEPTED
o STARTED
o COMPLETED
o CANCELLED
6. The system should calculate the fare based on factors like distance,
time, and surge pricing.
7. Payment should be processed only after the ride is completed.
8. The system should support multiple payment methods such as UPI,
Card, and Cash.
Constraints
1. A driver can handle only one ride at a time.
2. Only AVAILABLE drivers can be assigned to a ride.
3. A ride must follow valid state transitions.
4. Fare should not change after the ride is completed.
Technical Expectations (OOP Concepts to Apply)
Your design must demonstrate the following:
1. Classes, Objects, and Encapsulation
2. Inheritance and Polymorphism
3. Interfaces and Abstract Classes
4. Constructor Usage
5. Packages and Access Modifiers
6. String Handling and Utility Classes
7. Object Relationships and Composition

Additional Expectations
 Design appropriate classes and relationships.
 Follow clean code principles and separation of concerns.
 Use suitable design patterns where applicable.
 Ensure the system is extensible and maintainable.
2. Design a food delivery system with the following requirements:
Functional Requirements
1. Users should be able to browse restaurants and view menus.
2. Users can add multiple food items to a cart and place an order.
3. The system should assign a delivery partner to the order.
4. Delivery partner can accept or reject the delivery request.
5. If rejected, the system should assign another delivery partner.
6. The order should go through the following states:
o CREATED
o CONFIRMED
o PREPARING
o OUT_FOR_DELIVERY
o DELIVERED
o CANCELLED
7. The system should calculate total cost including:
o item price
o taxes
o delivery fee
o surge charges (if applicable)
8. Payment should be supported via multiple methods (UPI, Card, Cash).
9. Users should be able to track their order in real time.
Constraints
1. A delivery partner can handle only one order at a time.
2. Only AVAILABLE delivery partners can be assigned.
3. Order must follow valid state transitions.
4. Total price should not change after order confirmation.
5. Cancel is allowed only before OUT_FOR_DELIVERY.

Technical Expectations (OOP Concepts to Apply)


Your design must demonstrate:
1. Classes, Objects, and Encapsulation
2. Inheritance and Polymorphism
3. Interfaces and Abstract Classes
4. Constructor Usage
5. Packages and Access Modifiers
6. String Handling and Utility Classes
7. Object Relationships and Composition

Additional Expectations
 Design scalable and modular classes
 Use design patterns (e.g., Strategy for pricing, State for order lifecycle)
 Ensure separation of concerns
 Make it easy to extend (e.g., add new payment methods or pricing
rules)

You might also like