Project 45455
Project 45455
```java
package m.merchandise.entities;
// Constructor
public Merchandise(int partnerId, String partnerName, String city,
String state) {
this.partnerId = partnerId;
this.partnerName = partnerName;
this.city = city;
this.state = state;
}
```java
package m.merchandise.entities;
// Constructor
public Supplier(int partnerId, String partnerName, String city,
String state,
double creditBalance, String adharNumber) {
super(partnerId, partnerName, city, state);
this.creditBalance = creditBalance;
this.adharNumber = adharNumber;
}
```java
package com.merchandise.services;
import java.util.ArrayList;
import java.util.List;
import m.merchandise.entities.Customer;
import m.merchandise.entities.Supplier;
public MerchandiseService() {
this.customers = new ArrayList<>();
this.suppliers = new ArrayList<>();
}
// CRUD Operations
```java
package com.merchandise.consolepack;
import java.util.Scanner;
import com.merchandise.services.MerchandiseService;
while (true) {
System.out.println("Menu:");
System.out.println("a. Add Customer");
System.out.println("b. Add Supplier");
System.out.println("c. Display Report");
System.out.println("d. Search");
System.out.println("e. Exit");
System.out.print("Enter your choice: ");
String choice = scanner.next();
switch (choice.toLowerCase()) {
case "a":
// Add Customer
System.out.println("Enter Customer details:");
// Collect input and create Customer object
// Call merchandiseService.addCustomer(customer);
break;
case "b":
// Add Supplier
System.out.println("Enter Supplier details:");
// Collect input and create Supplier object
// Call merchandiseService.addSupplier(supplier);
break;
case "c":
// Display Report
System.out.println("Report:");
System.out.println("i. Customers - Display all Customer
Details");
System.out.println("ii. Suppliers - Display all Supplier
Details");
// Call respective methods from merchandiseService
break;
case "d":
// Search
System.out.println("Enter Customer ID to search:");
int customerId = scanner.nextInt();
// Call merchandiseService.getCustomerById(customerId);
// Display the details if found
break;
case "e":
// Exit
System.out.println("Exiting application...");
System.exit(0);
break;
default:
System.out.println("Invalid choice. Please try again.");
}
}
}
}
```