Assignment
Assignment
import java.util.Scanner;
// Parameterized Constructor
public Article(String line) {
this.line = line;
this.count = 0;
}
// Main class
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
// Class User
class User {
private String username;
private String mobileNumber;
// Parameterized Constructor
public User(String username, String mobileNumber) {
this.username = username;
this.mobileNumber = mobileNumber;
}
// Constructor
public UserBO(List<User> userList) {
this.userList = userList;
}
// Main class
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
// Output notifications
for (String msg : UserBO.message) {
System.out.println(msg);
}
}
}
// Constructor
public Stall(String stallName, String details, double stallArea, String owner) {
this.stallName = stallName;
this.details = details;
this.stallArea = stallArea;
this.owner = owner;
}
@Override
public void run() {
this.stallCost = this.stallArea * 150.0;
}
}
if (n <= 0) {
System.out.println("Invalid number of stalls.");
return;
}
// SupplierBO.java
import java.util.*;
while (continueLoop) {
System.out.println("Menu\n1.Add Supplier\n2.Display Supplier\n3.Search Supplier\
nEnter your choice");
int choice = Integer.parseInt(scanner.nextLine());
switch (choice) {
case 1:
System.out.println("Enter the Supplier details in CSV format");
String supplierDetails = scanner.nextLine();
supplierBO.createSupplier(supplierDetails, supplierList);
System.out.println("Supplier created successfully");
break;
case 2:
if (supplierList.isEmpty()) {
System.out.println("No suppliers to display");
} else {
System.out.println("Supplier Details");
supplierBO.display(supplierList);
}
break;
case 3:
System.out.println("Enter the Supplier email to search :");
String email = scanner.nextLine();
Supplier supplier = supplierBO.searchSupplierFromList(email, supplierList);
if (supplier != null) {
System.out.println("Supplier Detail");
System.out.format("%s %20s %30s %20s %10s\n",
"supplier_Id", "supplier_Name", "supplier FullAddressDeatails",
"supplier_Email", "PhoneNO");
System.out.format("%10d %20s %30s %20s %10s\n",
supplier.getSupplier_Id(),
supplier.getSupplier_Name(),
supplier.getSupplier_Address(),
supplier.getEmail(),
supplier.getPhoneNO());
} else {
System.out.println("Supplier not found");
}
break;
default:
System.out.println("Invalid choice");
break;
}
import java.util.*;
// Define the User class
class User {
private String username;
private String password;
// Default constructor
public User() {}
// Parameterized constructor
public User(String username, String password) {
this.username = username;
this.password = password;
}
if (n <= 0) {
System.out.println("Invalid Input");
return;
}
// Create a destination list with the same size as the source list
List<User> destList = new ArrayList<>(Collections.nCopies(n, null));
sc.close();
}
}
import java.util.*;
// Define the TicketBooking class implementing Comparable
class TicketBooking implements Comparable<TicketBooking> {
private String customerName;
private Integer price;
// Parameterized constructor
public TicketBooking(String customerName, Integer price) {
this.customerName = customerName;
this.price = price;
}
if (n <= 0) {
System.out.println("Invalid Input");
return;
}
sc.close();
}
}
// Constructor
public Product(int productId, String productName, String description, double price) {
this.productId = productId;
this.productName = productName;
this.description = description;
this.price = price;
}
@Override
public String toString() {
return productId + "," + productName + "," + description + "," + price;
}
}
if (!found) {
System.out.println("Product having price greater than Rs.15000 is not found...");
}
}
}
System.out.println();
ProductBO.display(productList);
}
}
// Constructor
public Product(int productId, String productName, String description, double price) {
this.productId = productId;
this.productName = productName;
this.description = description;
this.price = price;
}
@Override
public String toString() {
return productId + "," + productName + "," + description + "," + price;
}
}
if (!found) {
System.out.println("Product having price greater than Rs.15000 is not found...");
}
}
}
System.out.println();
ProductBO.display(productList);
}
}
// Constructor
public Customer(int id, String firstName, String lastName, String city, String email) {
this.id = id;
this.firstName = firstName;
this.lastName = lastName;
this.city = city;
this.email = email;
}
@Override
public String toString() {
return String.format("%-15d %-20s %-15s %-10s %s", id, firstName, lastName, city,
email);
}
}