Skip to content

Commit dfdadc9

Browse files
author
Dhananjay Nagargoje
committed
LLD
1 parent 4f3b16a commit dfdadc9

16 files changed

+3401
-0
lines changed

Diff for: src/main/java/oopadesign/airlinemgmt

+185
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
public enum FlightStatus{
2+
ACTIVE,
3+
SCHEDULED,
4+
DELAYED,
5+
DEPARTED,
6+
LANDED,
7+
IN_AIR,
8+
ARRIVED,
9+
CANCELLED,
10+
DIVERTED,
11+
UNKNOWN
12+
}
13+
14+
public enum PaymentStatus{
15+
UNPAID,
16+
PENDING,
17+
COMPLETED,
18+
FILLED,
19+
DECLINED,
20+
CANCELLED,
21+
ABANDONED,
22+
SETTLING,
23+
SETTLED,
24+
REFUNDED
25+
}
26+
27+
public enum ReservationStatus{
28+
REQUESTED,
29+
PENDING,
30+
CONFIRMED,
31+
CHECKED_IN,
32+
CANCELLED,
33+
ABANDONED
34+
}
35+
36+
public enum SeatClass {
37+
ECONOMY,
38+
ECONOMY_PLUS,
39+
PREFERRED_ECONOMY,
40+
BUSINESS,
41+
FIRST_CLASS
42+
}
43+
44+
public enum SeatType {
45+
REGULAR,
46+
ACCESSIBLE,
47+
EMERGENCY_EXIT,
48+
EXTRA_LEG_ROOM
49+
}
50+
51+
public enum AccountStatus{
52+
ACTIVE,
53+
CLOSED,
54+
CANCELED,
55+
BLACKLISTED,
56+
BLOCKED
57+
}
58+
59+
public class Address {
60+
private String streetAddress;
61+
private String city;
62+
private String state;
63+
private String zipCode;
64+
private String country;
65+
}
66+
67+
// For simplicity, we are not defining getter and setter functions. The reader can
68+
// assume that all class attributes are private and accessed through their respective
69+
// public getter method and modified only through their public setter method.
70+
71+
public class Account {
72+
private String id;
73+
private String password;
74+
private AccountStatus status;
75+
76+
public boolean resetPassword();
77+
}
78+
79+
public abstract class Person {
80+
private String name;
81+
private Address address;
82+
private String email;
83+
private String phone;
84+
85+
private Account account;
86+
}
87+
88+
public class Customer extends Person {
89+
private String frequentFlyerNumber;
90+
91+
public List<Itinerary> getItineraries();
92+
}
93+
94+
public class Passenger {
95+
private String name;
96+
private String passportNumber;
97+
private Date dateOfBirth;
98+
99+
public String getPassportNumber() {
100+
return this.passportNumber;
101+
}
102+
}
103+
104+
public class Airport {
105+
private String name;
106+
private Address address;
107+
private String code;
108+
109+
public List<Flight> getFlights();
110+
}
111+
112+
public class Aircraft {
113+
private String name;
114+
private String model;
115+
private int manufacturingYear;
116+
private List<Seat> seats;
117+
118+
public List<FlightInstance> getFlights();
119+
}
120+
121+
public class Seat {
122+
private String seatNumber;
123+
private SeatType type;
124+
private SeatClass _class;
125+
}
126+
127+
public class FlightSeat extends Seat {
128+
private double fare;
129+
public double getFare();
130+
}
131+
132+
133+
public class WeeklySchedule {
134+
private int dayOfWeek;
135+
private Time departureTime;
136+
}
137+
138+
public class CustomSchedule {
139+
private Date customDate;
140+
private Time departureTime;
141+
}
142+
143+
public class Flight {
144+
private String flightNumber;
145+
private Airport departure;
146+
private Airport arrival;
147+
private int durationInMinutes;
148+
149+
private List<WeeklySchedules> weeklySchedules;
150+
private List<CustomSchedules> customSchedules;
151+
private List<FlightInstance> flightInstances;
152+
}
153+
154+
public class FlightInstance {
155+
private Date departureTime;
156+
private String gate;
157+
private FlightStatus status;
158+
private Aircraft aircraft;
159+
160+
public bool cancel();
161+
public void updateStatus(FlightStatus status);
162+
}
163+
164+
public class FlightReservation {
165+
private String reservationNumber;
166+
private FlightInstance flight;
167+
private Map<Passenger, FlightSeat> seatMap;
168+
private Date creationDate;
169+
private ReservationStatus status;
170+
171+
public static FlightReservation fetchReservationDetails(String reservationNumber);
172+
public List<Passenger> getPassengers();
173+
}
174+
175+
public class Itinerary {
176+
private String customerId;
177+
private Airport startingAirport;
178+
private Airport finalAirport;
179+
private Date creationDate;
180+
private List<FlightReservation> reservations;
181+
182+
public List<FlightReservation> getReservations();
183+
public boolean makeReservation();
184+
public boolean makePayment();
185+
}

Diff for: src/main/java/oopadesign/amazon.md

+166
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
public class Address {
2+
private String streetAddress;
3+
private String city;
4+
private String state;
5+
private String zipCode;
6+
private String country;
7+
}
8+
9+
public enum OrderStatus {
10+
UNSHIPPED, PENDING, SHIPPED, COMPLETED, CANCELED, REFUND_APPLIED
11+
}
12+
13+
public enum AccountStatus {
14+
ACTIVE, BLOCKED, BANNED, COMPROMISED, ARCHIVED, UNKNOWN
15+
}
16+
17+
public enum ShipmentStatus {
18+
PENDING, SHIPPED, DELIVERED, ON_HOLD,
19+
}
20+
21+
public enum PaymentStatus {
22+
UNPAID, PENDING, COMPLETED, FILLED, DECLINED, CANCELLED, ABANDONED, SETTLING, SETTLED, REFUNDED
23+
}
24+
25+
// For simplicity, we are not defining getter and setter functions. The reader can
26+
// assume that all class attributes are private and accessed through their respective
27+
// public getter methods and modified only through their public methods function.
28+
29+
public class Account {
30+
private String userName;
31+
private String password;
32+
private AccountStatus status;
33+
private String name;
34+
private Address shippingAddress;
35+
private String email;
36+
private String phone;
37+
38+
private List<CreditCard> creditCards;
39+
private List<ElectronicBankTransfer> bankAccounts;
40+
41+
public boolean addProduct(Product product);
42+
public boolean addProductReview(ProductReview review);
43+
public boolean resetPassword();
44+
}
45+
46+
public abstract class Customer {
47+
private ShoppingCart cart;
48+
private Order order;
49+
50+
public ShoppingCart getShoppingCart();
51+
public bool addItemToCart(Item item);
52+
public bool removeItemFromCart(Item item);
53+
}
54+
55+
public class Guest extends Customer {
56+
public bool registerAccount();
57+
}
58+
59+
public class Member extends Customer {
60+
private Account account;
61+
public OrderStatus placeOrder(Order order);
62+
}
63+
64+
public class ProductCategory {
65+
private String name;
66+
private String description;
67+
}
68+
69+
public class ProductReview {
70+
private int rating;
71+
private String review;
72+
73+
private Member reviewer;
74+
}
75+
76+
public class Product {
77+
private String productID;
78+
private String name;
79+
private String description;
80+
private double price;
81+
private ProductCategory category;
82+
private int availableItemCount;
83+
84+
private Account seller;
85+
86+
public int getAvailableCount();
87+
public boolean updatePrice(double newPrice);
88+
}
89+
90+
public class Item {
91+
private String productID;
92+
private int quantity;
93+
private double price;
94+
95+
public boolean updateQuantity(int quantity);
96+
}
97+
98+
public class ShoppingCart {
99+
private List<Items> items;
100+
101+
public boolean addItem(Item item);
102+
public boolean removeItem(Item item);
103+
public boolean updateItemQuantity(Item item, int quantity);
104+
public List<Item> getItems();
105+
public boolean checkout();
106+
}
107+
108+
public class OrderLog {
109+
private String orderNumber;
110+
private Date creationDate;
111+
private OrderStatus status;
112+
}
113+
114+
public class Order {
115+
private String orderNumber;
116+
private OrderStatus status;
117+
private Date orderDate;
118+
private List<OrderLog> orderLog;
119+
120+
public boolean sendForShipment();
121+
public boolean makePayment(Payment payment);
122+
public boolean addOrderLog(OrderLog orderLog);
123+
}
124+
125+
public class ShipmentLog {
126+
private String shipmentNumber;
127+
private ShipmentStatus status;
128+
private Date creationDate;
129+
}
130+
131+
public class Shipment {
132+
private String shipmentNumber;
133+
private Date shipmentDate;
134+
private Date estimatedArrival;
135+
private String shipmentMethod;
136+
private List<ShipmentLog> shipmentLogs;
137+
138+
public boolean addShipmentLog(ShipmentLog shipmentLog);
139+
}
140+
141+
public abstract class Notification {
142+
private int notificationId;
143+
private Date createdOn;
144+
private String content;
145+
146+
public boolean sendNotification(Account account);
147+
}
148+
149+
150+
public interface Search {
151+
public List<Product> searchProductsByName(String name);
152+
public List<Product> searchProductsByCategory(String category);
153+
}
154+
155+
public class Catalog implements Search {
156+
HashMap<String, List<Product>> productNames;
157+
HashMap<String, List<Product>> productCategories;
158+
159+
public List<Product> searchProductsByName(String name) {
160+
return productNames.get(name);
161+
}
162+
163+
public List<Product> searchProductsByCategory(String category) {
164+
return productCategories.get(category);
165+
}
166+
}

0 commit comments

Comments
 (0)