diff --git a/.DS_Store b/.DS_Store
index d883ecd..aecc6b3 100644
Binary files a/.DS_Store and b/.DS_Store differ
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..639900d
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..db50d9d
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
new file mode 100644
index 0000000..99616e0
--- /dev/null
+++ b/.idea/workspace.xml
@@ -0,0 +1,52 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1700631973066
+
+
+ 1700631973066
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/CS151.iml b/CS151.iml
new file mode 100644
index 0000000..d85a11e
--- /dev/null
+++ b/CS151.iml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/homework/src/HW1/submissions/partA/README.md b/homework/src/HW1/submissions/partA/README.md
index cd40819..5f36b44 100644
--- a/homework/src/HW1/submissions/partA/README.md
+++ b/homework/src/HW1/submissions/partA/README.md
@@ -1 +1 @@
-Add your submissions for part A of the homework here.
\ No newline at end of file
+Edward's submission for HW1 Part A
\ No newline at end of file
diff --git a/homework/src/HW1/submissions/partA/airbnb/BookingService.java b/homework/src/HW1/submissions/partA/airbnb/BookingService.java
new file mode 100644
index 0000000..9b6cb06
--- /dev/null
+++ b/homework/src/HW1/submissions/partA/airbnb/BookingService.java
@@ -0,0 +1,5 @@
+package HW1.submissions.partA.airbnb;
+
+public interface BookingService {
+ int calculateTotalPrice(HotelInterface hotel, int numberOfNights);
+}
diff --git a/homework/src/HW1/submissions/partA/airbnb/BookingServiceImpl.java b/homework/src/HW1/submissions/partA/airbnb/BookingServiceImpl.java
new file mode 100644
index 0000000..776f33e
--- /dev/null
+++ b/homework/src/HW1/submissions/partA/airbnb/BookingServiceImpl.java
@@ -0,0 +1,9 @@
+package HW1.submissions.partA.airbnb;
+
+public class BookingServiceImpl implements BookingService{
+ @Override
+ public int calculateTotalPrice(HotelInterface hotel, int numberOfNights){
+ int totalPrice = hotel.calculateTotalPrice(numberOfNights);
+ return totalPrice;
+ }
+}
diff --git a/homework/src/HW1/submissions/partA/airbnb/DiscountedHotel.java b/homework/src/HW1/submissions/partA/airbnb/DiscountedHotel.java
new file mode 100644
index 0000000..0d79ca7
--- /dev/null
+++ b/homework/src/HW1/submissions/partA/airbnb/DiscountedHotel.java
@@ -0,0 +1,8 @@
+package HW1.submissions.partA.airbnb;
+
+public class DiscountedHotel implements HotelInterface{
+ @Override
+ public int calculateTotalPrice(int numberOfNights){
+ return numberOfNights*50;
+ }
+}
diff --git a/homework/src/HW1/submissions/partA/airbnb/Hotel.java b/homework/src/HW1/submissions/partA/airbnb/Hotel.java
new file mode 100644
index 0000000..15b7b63
--- /dev/null
+++ b/homework/src/HW1/submissions/partA/airbnb/Hotel.java
@@ -0,0 +1,8 @@
+package HW1.submissions.partA.airbnb;
+
+public class Hotel implements HotelInterface{
+ @Override
+ public int calculateTotalPrice(int numberOfNights){
+ return numberOfNights*100;
+ }
+}
diff --git a/homework/src/HW1/submissions/partA/airbnb/HotelInterface.java b/homework/src/HW1/submissions/partA/airbnb/HotelInterface.java
new file mode 100644
index 0000000..dd9a837
--- /dev/null
+++ b/homework/src/HW1/submissions/partA/airbnb/HotelInterface.java
@@ -0,0 +1,5 @@
+package HW1.submissions.partA.airbnb;
+
+public interface HotelInterface {
+ int calculateTotalPrice(int numberOfNights);
+}
diff --git a/homework/src/HW1/submissions/partA/airbnb/Main.java b/homework/src/HW1/submissions/partA/airbnb/Main.java
new file mode 100644
index 0000000..7a89365
--- /dev/null
+++ b/homework/src/HW1/submissions/partA/airbnb/Main.java
@@ -0,0 +1,15 @@
+package HW1.submissions.partA.airbnb;
+
+public class Main {
+ public static void main(String[] args){
+ HotelInterface regularHotel = new Hotel();
+ HotelInterface discountedHotel = new DiscountedHotel();
+
+ BookingService bookingService = new BookingServiceImpl();
+ int regularHotelTotalPrice = bookingService.calculateTotalPrice(regularHotel, 3);
+ int discountedHotelTotalPrice = bookingService.calculateTotalPrice(discountedHotel, 3);
+
+ System.out.println("Regular Hotel Total Price: $"+regularHotelTotalPrice);
+ System.out.println("Discounted Hotel Total Price: $"+discountedHotelTotalPrice);
+ }
+}
diff --git a/homework/src/HW1/submissions/partA/airbnb/README.md b/homework/src/HW1/submissions/partA/airbnb/README.md
new file mode 100644
index 0000000..0e9f615
--- /dev/null
+++ b/homework/src/HW1/submissions/partA/airbnb/README.md
@@ -0,0 +1,7 @@
+Q) which SOLID principle(s) is this company violating?
+A) this company violates Liskov Substitution Principle and Open Closed Principle.
+
+Q) Your approach to making changes to fix the violation
+A) LSP is satisfied by introducing an interface HotelInterface which is implemented by the class Hotel and the class DiscountedHotel.
+Consequently, in the interface BookingService and the class BookingServiceImpl, the method calculateTotalPrice takes a parameter of type HotelInterface rather than type Hotel.
+OCP is satisfied as further additions of hotels/ specific hotel features can now be done without modifying existing classes or class contents but rather just extending them.
\ No newline at end of file
diff --git a/homework/src/HW1/submissions/partA/doordash/Customer.java b/homework/src/HW1/submissions/partA/doordash/Customer.java
new file mode 100644
index 0000000..81aeaf3
--- /dev/null
+++ b/homework/src/HW1/submissions/partA/doordash/Customer.java
@@ -0,0 +1,13 @@
+package HW1.submissions.partA.doordash;
+
+public class Customer {
+ private String name;
+
+ public Customer(String name){
+ this.name = name;
+ }
+
+ public String getName(){
+ return name;
+ }
+}
diff --git a/homework/src/HW1/submissions/partA/doordash/Deliverable.java b/homework/src/HW1/submissions/partA/doordash/Deliverable.java
new file mode 100644
index 0000000..498d707
--- /dev/null
+++ b/homework/src/HW1/submissions/partA/doordash/Deliverable.java
@@ -0,0 +1,5 @@
+package HW1.submissions.partA.doordash;
+
+public interface Deliverable {
+ void deliverPackage(Seller seller, Customer customer);
+}
diff --git a/homework/src/HW1/submissions/partA/doordash/FoodDeliveryService.java b/homework/src/HW1/submissions/partA/doordash/FoodDeliveryService.java
new file mode 100644
index 0000000..57bf251
--- /dev/null
+++ b/homework/src/HW1/submissions/partA/doordash/FoodDeliveryService.java
@@ -0,0 +1,13 @@
+package HW1.submissions.partA.doordash;
+
+public class FoodDeliveryService implements Deliverable{
+ @Override
+ public void deliverPackage(Seller seller, Customer customer) {
+ if(seller instanceof Restaurant that) {
+ System.out.println("Food delivered from " + that.getName() + " to " + customer.getName());
+ }
+ else{
+ System.out.println("We support only restaurant orders for now!");
+ }
+ }
+}
diff --git a/homework/src/HW1/submissions/partA/doordash/FoodTrackingService.java b/homework/src/HW1/submissions/partA/doordash/FoodTrackingService.java
new file mode 100644
index 0000000..7e1e76b
--- /dev/null
+++ b/homework/src/HW1/submissions/partA/doordash/FoodTrackingService.java
@@ -0,0 +1,8 @@
+package HW1.submissions.partA.doordash;
+
+public class FoodTrackingService implements Trackable{
+ @Override
+ public void trackPackage(String trackingNumber) {
+ System.out.println("Package with tracking number " + trackingNumber + "is being tracked.");
+ }
+}
diff --git a/homework/src/HW1/submissions/partA/doordash/GroceryStore.java b/homework/src/HW1/submissions/partA/doordash/GroceryStore.java
new file mode 100644
index 0000000..180cf0a
--- /dev/null
+++ b/homework/src/HW1/submissions/partA/doordash/GroceryStore.java
@@ -0,0 +1,13 @@
+package HW1.submissions.partA.doordash;
+
+public class GroceryStore implements Seller{
+ private String name;
+
+ public GroceryStore(String name){
+ this.name = name;
+ }
+
+ public String getName(){
+ return name;
+ }
+}
diff --git a/homework/src/HW1/submissions/partA/doordash/Main.java b/homework/src/HW1/submissions/partA/doordash/Main.java
new file mode 100644
index 0000000..7d422d3
--- /dev/null
+++ b/homework/src/HW1/submissions/partA/doordash/Main.java
@@ -0,0 +1,12 @@
+package HW1.submissions.partA.doordash;
+
+public class Main {
+ public static void main(String[] args){
+ FoodDeliveryService foodDeliveryService = new FoodDeliveryService();
+ FoodTrackingService foodTrackingService = new FoodTrackingService();
+
+ foodDeliveryService.deliverPackage(new Restaurant("McDonalds"), new Customer("Anant"));
+ foodDeliveryService.deliverPackage(new GroceryStore("Safeway"), new Customer("Edward"));
+ foodTrackingService.trackPackage("5E96MQ3XPL");
+ }
+}
diff --git a/homework/src/HW1/submissions/partA/doordash/README.md b/homework/src/HW1/submissions/partA/doordash/README.md
new file mode 100644
index 0000000..b17858e
--- /dev/null
+++ b/homework/src/HW1/submissions/partA/doordash/README.md
@@ -0,0 +1,11 @@
+1) which SOLID principle(s) is this company violating?
+This company violates Single Responsibility Principle and Interface Segregation Principle.
+
+
+2) Your approach to making changes to fix the violation
+ISP is satisfied by breaking down the interface DeliveryService into more client-specific interfaces Deliverable and Trackable.
+Consequently, the class FoodDeliveryAndTrackingService is also broken down into class FoodDeliveryService and class FoodTrackingService
+with each correspondingly implementing Deliverable interface and Trackable interface, thus making SRP satisfied. While not violating yet, based on the recent
+capabilities, using Restaurant class my potentially violate LSP since items beyond food can be ordered on DoorDash, so I created an interface Seller
+with the class Restaurant implementing it for future expansions. I also made use of instanceof operator and 'that' keyword to verify
+this recent version supports only the restaurant orders for now.
\ No newline at end of file
diff --git a/homework/src/HW1/submissions/partA/doordash/Restaurant.java b/homework/src/HW1/submissions/partA/doordash/Restaurant.java
new file mode 100644
index 0000000..2c683d8
--- /dev/null
+++ b/homework/src/HW1/submissions/partA/doordash/Restaurant.java
@@ -0,0 +1,13 @@
+package HW1.submissions.partA.doordash;
+
+public class Restaurant implements Seller{
+ private String name;
+
+ public Restaurant(String name){
+ this.name = name;
+ }
+
+ public String getName(){
+ return name;
+ }
+}
diff --git a/homework/src/HW1/submissions/partA/doordash/Seller.java b/homework/src/HW1/submissions/partA/doordash/Seller.java
new file mode 100644
index 0000000..a587703
--- /dev/null
+++ b/homework/src/HW1/submissions/partA/doordash/Seller.java
@@ -0,0 +1,5 @@
+package HW1.submissions.partA.doordash;
+
+public interface Seller {
+
+}
diff --git a/homework/src/HW1/submissions/partA/doordash/Trackable.java b/homework/src/HW1/submissions/partA/doordash/Trackable.java
new file mode 100644
index 0000000..6487497
--- /dev/null
+++ b/homework/src/HW1/submissions/partA/doordash/Trackable.java
@@ -0,0 +1,5 @@
+package HW1.submissions.partA.doordash;
+
+public interface Trackable {
+ void trackPackage(String trackingNumber);
+}
diff --git a/homework/src/HW1/submissions/partA/facebook/Image.java b/homework/src/HW1/submissions/partA/facebook/Image.java
new file mode 100644
index 0000000..0833132
--- /dev/null
+++ b/homework/src/HW1/submissions/partA/facebook/Image.java
@@ -0,0 +1,13 @@
+package HW1.submissions.partA.facebook;
+
+public class Image {
+ private String imageUrl;
+ private boolean isImage;
+
+ public Image(String imageUrl){
+ this.imageUrl = imageUrl;
+ this.isImage = true;
+ }
+ public String getImageUrl(){return imageUrl;}
+ public boolean isImage(){return isImage;}
+}
diff --git a/homework/src/HW1/submissions/partA/facebook/Main.java b/homework/src/HW1/submissions/partA/facebook/Main.java
new file mode 100644
index 0000000..50e3218
--- /dev/null
+++ b/homework/src/HW1/submissions/partA/facebook/Main.java
@@ -0,0 +1,15 @@
+package HW1.submissions.partA.facebook;
+
+public class Main {
+ public static void main(String[] args){
+ Post post1 = new Post(new Text("text-only post"));
+ Post post2 = new Post(new Text("text and image post"), new Image("...some image url..."));
+ Post post3 = new Post(new Text("text and video post"), new Video("...some video url..."));
+ Post post4 = new Post(new Text("text, image, and video post"), new Image("...some image url..."), new Video("...some video url..."));
+
+ System.out.println(post1);
+ System.out.println(post2);
+ System.out.println(post3);
+ System.out.println(post4);
+ }
+}
diff --git a/homework/src/HW1/submissions/partA/facebook/Post.java b/homework/src/HW1/submissions/partA/facebook/Post.java
new file mode 100644
index 0000000..3bff092
--- /dev/null
+++ b/homework/src/HW1/submissions/partA/facebook/Post.java
@@ -0,0 +1,35 @@
+package HW1.submissions.partA.facebook;
+
+public class Post {
+ private Text text;
+ private Image image;
+ private Video video;
+
+ public Post(Text text){
+ this.text = text;
+ }
+ public Post(Text text, Image image){
+ this.text = text;
+ this.image = image;
+ }
+ public Post(Text text, Video video){
+ this.text = text;
+ this.video = video;
+ }
+ public Post(Text text, Image image, Video video){
+ this.text = text;
+ this.image = image;
+ this.video = video;
+ }
+
+ public void displayText(){
+ System.out.println(text.getText());
+ }
+
+ @Override
+ public String toString(){
+ return "Post: " + text.getText() + "\n" +
+ "Image: " + (image != null ? image.getImageUrl() : "NO image url provided") + "\n" +
+ "Video: " + (video != null ? video.getVideoUrl() : "NO video url provided") + "\n";
+ }
+}
diff --git a/homework/src/HW1/submissions/partA/facebook/README.md b/homework/src/HW1/submissions/partA/facebook/README.md
new file mode 100644
index 0000000..f2efca4
--- /dev/null
+++ b/homework/src/HW1/submissions/partA/facebook/README.md
@@ -0,0 +1,7 @@
+1) which SOLID principle(s) is this company violating?
+This company violates Single Responsibility Principle.
+
+2) Your approach to making changes to fix the violations.
+Post2 class violates SRP because it looks 'fat' with multiple sets of related attributes.
+Once implemented with methods, such class layout can easily get swamped with multiple methods that function differently on various not-so-related attributes.
+I split the class Post2 into classes - Post, Text, Image and Video - each of which can be configured with more specific attributes and methods for further development while also allowing each to either extend a superclass or implement interfaces to provide more enriched features.
diff --git a/homework/src/HW1/submissions/partA/facebook/Text.java b/homework/src/HW1/submissions/partA/facebook/Text.java
new file mode 100644
index 0000000..339fa24
--- /dev/null
+++ b/homework/src/HW1/submissions/partA/facebook/Text.java
@@ -0,0 +1,8 @@
+package HW1.submissions.partA.facebook;
+
+public class Text {
+ private String text;
+
+ public Text(String text){this.text = text;}
+ public String getText(){return text;}
+}
diff --git a/homework/src/HW1/submissions/partA/facebook/Video.java b/homework/src/HW1/submissions/partA/facebook/Video.java
new file mode 100644
index 0000000..a0bfa50
--- /dev/null
+++ b/homework/src/HW1/submissions/partA/facebook/Video.java
@@ -0,0 +1,13 @@
+package HW1.submissions.partA.facebook;
+
+public class Video {
+ private String videoUrl;
+ private boolean isVideo;
+
+ public Video(String videoUrl){
+ this.videoUrl = videoUrl;
+ this.isVideo = true;
+ }
+ public String getVideoUrl(){return videoUrl;}
+ public boolean isVideo(){return isVideo;}
+}
diff --git a/homework/src/HW1/submissions/partA/paypal/Account.java b/homework/src/HW1/submissions/partA/paypal/Account.java
new file mode 100644
index 0000000..7953aae
--- /dev/null
+++ b/homework/src/HW1/submissions/partA/paypal/Account.java
@@ -0,0 +1,11 @@
+package HW1.submissions.partA.paypal;
+
+public class Account {
+ private String accountID;
+
+ public Account(String accountID){
+ this.accountID = accountID;
+ }
+
+ public String getAccountID(){return accountID;}
+}
diff --git a/homework/src/HW1/submissions/partA/paypal/Main.java b/homework/src/HW1/submissions/partA/paypal/Main.java
new file mode 100644
index 0000000..270ca95
--- /dev/null
+++ b/homework/src/HW1/submissions/partA/paypal/Main.java
@@ -0,0 +1,16 @@
+package HW1.submissions.partA.paypal;
+
+public class Main {
+ public static void main(String[] args){
+ PayEntity payEntity = new PayEntity();
+
+ payEntity.setPaymentProcessorService(new PaymentProcessor(new Account("123456789")));
+ payEntity.process(150);
+
+ payEntity.setPaymentProcessorService(new PayPalGateway(new Account("987654321")));
+ payEntity.process(300);
+
+ payEntity.setPaymentProcessorService(null);
+ payEntity.process(500);
+ }
+}
diff --git a/homework/src/HW1/submissions/partA/paypal/PayEntity.java b/homework/src/HW1/submissions/partA/paypal/PayEntity.java
new file mode 100644
index 0000000..af151e9
--- /dev/null
+++ b/homework/src/HW1/submissions/partA/paypal/PayEntity.java
@@ -0,0 +1,23 @@
+package HW1.submissions.partA.paypal;
+
+import com.sun.source.tree.PatternCaseLabelTree;
+
+public class PayEntity {
+ private PaymentProcessorService paymentProcessorService;
+
+ public void setPaymentProcessorService(PaymentProcessorService paymentProcessorService){
+ this.paymentProcessorService = paymentProcessorService;
+ }
+ public void process(double amount){
+ if(paymentProcessorService !=null){
+ if(paymentProcessorService instanceof PaymentProcessor that){
+ that.processPayment(amount);
+ }
+ else if(paymentProcessorService instanceof PayPalGateway that){
+ that.processPayment(amount);
+ }
+ else System.out.println("Unknown payment processor service!");
+ }
+ else System.out.println("Please set payment processor service first!");
+ }
+}
diff --git a/homework/src/HW1/submissions/partA/paypal/PayPalGateway.java b/homework/src/HW1/submissions/partA/paypal/PayPalGateway.java
new file mode 100644
index 0000000..adac3f0
--- /dev/null
+++ b/homework/src/HW1/submissions/partA/paypal/PayPalGateway.java
@@ -0,0 +1,13 @@
+package HW1.submissions.partA.paypal;
+
+public class PayPalGateway implements PaymentProcessorService{
+ private Account account;
+
+ public PayPalGateway(Account account){
+ this.account = account;
+ }
+ @Override
+ public void processPayment(double amount){
+ System.out.println("Processing payment of $" + amount + " for account " + account.getAccountID() + " using PayPalGateway.");
+ }
+}
diff --git a/homework/src/HW1/submissions/partA/paypal/PaymentProcessor.java b/homework/src/HW1/submissions/partA/paypal/PaymentProcessor.java
new file mode 100644
index 0000000..8cddcef
--- /dev/null
+++ b/homework/src/HW1/submissions/partA/paypal/PaymentProcessor.java
@@ -0,0 +1,14 @@
+package HW1.submissions.partA.paypal;
+
+public class PaymentProcessor implements PaymentProcessorService{
+ private Account account;
+
+ public PaymentProcessor(Account account){
+ this.account = account;
+ }
+
+ @Override
+ public void processPayment(double amount){
+ System.out.println("Processing payment of $" + amount + " for account " + account.getAccountID() + " using PaymentProcessor");
+ }
+}
diff --git a/homework/src/HW1/submissions/partA/paypal/PaymentProcessorService.java b/homework/src/HW1/submissions/partA/paypal/PaymentProcessorService.java
new file mode 100644
index 0000000..5d667e5
--- /dev/null
+++ b/homework/src/HW1/submissions/partA/paypal/PaymentProcessorService.java
@@ -0,0 +1,7 @@
+package HW1.submissions.partA.paypal;
+
+public interface PaymentProcessorService {
+ default void processPayment(double amount){
+ System.out.println("Processing payment of $" + amount + " for generic account using generic entity.");
+ }
+}
diff --git a/homework/src/HW1/submissions/partA/paypal/README.md b/homework/src/HW1/submissions/partA/paypal/README.md
new file mode 100644
index 0000000..9b37407
--- /dev/null
+++ b/homework/src/HW1/submissions/partA/paypal/README.md
@@ -0,0 +1,7 @@
+1) which SOLID principle(s) is this company violating?
+This company violates dependency inversion principle because the high-level module, PaymentProcessor, depends on low-leel module, PayPalGateway. Both these modules should depend on such an abstraction as an interface.
+
+2) Your approach to making changes to fix the violation
+An interface PaymentProcessorService was created, which is implemented by classes PaymentProcessor and PayPalGateway so that details can be implemented in low-level classes while guidelines can be designed within the interface.
+In addition, class PayEntity was also added with method process(...) to process payment through any class implementing PaymentProcessorService interface.
+Finally, in the Main class, the code is cleaned out by using only an object of PayEntity class to process payment through objects of multiple classes implementing PaymentProcessorService interface.
\ No newline at end of file
diff --git a/homework/src/HW1/submissions/partA/uber/Main.java b/homework/src/HW1/submissions/partA/uber/Main.java
new file mode 100644
index 0000000..49bfa25
--- /dev/null
+++ b/homework/src/HW1/submissions/partA/uber/Main.java
@@ -0,0 +1,15 @@
+package HW1.submissions.partA.uber;
+
+public class Main {
+ public static void main(String[] args){
+ Ride ride = new Ride(10, 20);
+ User user = new User();
+ user.setUsername("John Doe");
+
+ RideNotificationManager rideNotificationManager = new RideNotificationManager();
+ RideFareManager rideFareManager = new RideFareManager();
+
+ double fare = rideFareManager.calculateFare(ride);
+ rideNotificationManager.sendNotification(user, "Your ride fare is: "+fare);
+ }
+}
diff --git a/homework/src/HW1/submissions/partA/uber/README.md b/homework/src/HW1/submissions/partA/uber/README.md
new file mode 100644
index 0000000..ab7aeb5
--- /dev/null
+++ b/homework/src/HW1/submissions/partA/uber/README.md
@@ -0,0 +1,7 @@
+1) which SOLID principle(s) is this company violating?
+This company violates Single Responsibility Principle because RideManager class has two methods that can logically be separated - calculateFare(...)
+and sendNotification(...). By extension, it also violates Open-Closed Principle because, as configured now, any changes made to RideManager class impacts on both fare calculation and notification sending methods, potentially introducing more bugs along the way.
+
+2) Your approach to making changes to fix the violation
+RideManager is separated into RideFareManager class and RideNotificationManager class. The former class takes care of calculateFare(...) and allows room for
+further specifications of fare calculation. The latter class takes care of sendNotification(...).
\ No newline at end of file
diff --git a/homework/src/HW1/submissions/partA/uber/Ride.java b/homework/src/HW1/submissions/partA/uber/Ride.java
new file mode 100644
index 0000000..5239709
--- /dev/null
+++ b/homework/src/HW1/submissions/partA/uber/Ride.java
@@ -0,0 +1,16 @@
+package HW1.submissions.partA.uber;
+
+public class Ride {
+ private double distanceInMiles;
+ private int durationInMinutes;
+
+ public Ride(double distanceInMiles, int durationInMinutes){
+ this.distanceInMiles = distanceInMiles;
+ this.durationInMinutes = durationInMinutes;
+ }
+
+ public void setDistanceInMiles(double distanceInMiles){this.distanceInMiles = distanceInMiles;}
+ public void setDurationInMinutes(int durationInMinutes){this.durationInMinutes = durationInMinutes;}
+ public double getDistanceInMiles(){return distanceInMiles;}
+ public int getDurationInMinutes(){return durationInMinutes;}
+}
diff --git a/homework/src/HW1/submissions/partA/uber/RideFareManager.java b/homework/src/HW1/submissions/partA/uber/RideFareManager.java
new file mode 100644
index 0000000..f7975a9
--- /dev/null
+++ b/homework/src/HW1/submissions/partA/uber/RideFareManager.java
@@ -0,0 +1,19 @@
+package HW1.submissions.partA.uber;
+
+public class RideFareManager{
+ private final double BASE_FARE = 5.0;
+ private final double PER_MILE_FARE = 2.0;
+ private final double PER_MINUTE_FARE = 0.5;
+
+ public double calculateFare(Ride ride){
+ double distanceInMiles = ride.getDistanceInMiles();
+ int durationInMinutes = ride.getDurationInMinutes();
+
+ double distanceFare = distanceInMiles * PER_MILE_FARE;
+ double durationFare = durationInMinutes * PER_MINUTE_FARE;
+
+ double totalFare = BASE_FARE + distanceFare + durationFare;
+
+ return totalFare;
+ }
+}
diff --git a/homework/src/HW1/submissions/partA/uber/RideNotificationManager.java b/homework/src/HW1/submissions/partA/uber/RideNotificationManager.java
new file mode 100644
index 0000000..3e8995b
--- /dev/null
+++ b/homework/src/HW1/submissions/partA/uber/RideNotificationManager.java
@@ -0,0 +1,7 @@
+package HW1.submissions.partA.uber;
+
+public class RideNotificationManager{
+ public void sendNotification(User user, String message){
+ System.out.println("Notification sent to user: "+user.getUsername()+" - "+message);
+ }
+}
diff --git a/homework/src/HW1/submissions/partA/uber/User.java b/homework/src/HW1/submissions/partA/uber/User.java
new file mode 100644
index 0000000..93371ad
--- /dev/null
+++ b/homework/src/HW1/submissions/partA/uber/User.java
@@ -0,0 +1,8 @@
+package HW1.submissions.partA.uber;
+
+public class User {
+ private String username;
+
+ public void setUsername(String username){this.username = username;}
+ public String getUsername(){return username;}
+}
diff --git a/homework/src/HW1/submissions/partB/README.md b/homework/src/HW1/submissions/partB/README.md
index e4aa9c2..b4010f1 100644
--- a/homework/src/HW1/submissions/partB/README.md
+++ b/homework/src/HW1/submissions/partB/README.md
@@ -1 +1 @@
-Add your submissions for part B of the homework here.
\ No newline at end of file
+Edward's submission for HW1 Part B
\ No newline at end of file
diff --git a/homework/src/HW1/submissions/partB/edwardkhant/ekhant_cs151_partB_javafx_repoLink.txt b/homework/src/HW1/submissions/partB/edwardkhant/ekhant_cs151_partB_javafx_repoLink.txt
new file mode 100644
index 0000000..699a7e9
--- /dev/null
+++ b/homework/src/HW1/submissions/partB/edwardkhant/ekhant_cs151_partB_javafx_repoLink.txt
@@ -0,0 +1 @@
+https://github.com/MinKhant01/ekhant_javafx.git
\ No newline at end of file