From 6fa1d5b8c48ba0e2ac51be0b8f37f4f2efa45462 Mon Sep 17 00:00:00 2001 From: Manan Gupta Date: Tue, 11 Mar 2025 09:54:22 +0530 Subject: [PATCH 1/3] [Manan] ADD:Created a inventory management system --- InventorySystem.java | 45 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 InventorySystem.java diff --git a/InventorySystem.java b/InventorySystem.java new file mode 100644 index 0000000..734dbf3 --- /dev/null +++ b/InventorySystem.java @@ -0,0 +1,45 @@ +class Product { + private String productName; + private double price; + private static int totalProducts = 0; + + // Constructor + public Product(String productName, double price) { + this.productName = productName; + this.price = price; + totalProducts++; + } + + // Instance method to display product details + public void displayProductDetails() { + System.out.println("Product Name: " + productName); + System.out.println("Price: " + price); + } + + // Static method to display total products + public static void displayTotalProducts() { + System.out.println("Total Products: " + totalProducts); + } +} + +public class InventorySystem { + public static void main(String[] args) { + // Create instances of Product + Product product1 = new Product("MacBook", 89999.00); + Product product2 = new Product("iPhone", 79999.00); + + // Display details of each product + product1.displayProductDetails(); + product2.displayProductDetails(); + + // Display total number of products created + Product.displayTotalProducts(); + } +} + +//Sample Output +//Product Name: MacBook +//Price: 89999.0 +//Product Name: iPhone +//Price: 79999.0 +//Total Products: 2 \ No newline at end of file From 94a90f1089cfe80f922143ea8a5860c5fc8c7f4b Mon Sep 17 00:00:00 2001 From: Manan Gupta Date: Tue, 11 Mar 2025 09:57:20 +0530 Subject: [PATCH 2/3] [Manan] ADD:Created a course management system --- CourseManagementSystem.java | 70 +++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 CourseManagementSystem.java diff --git a/CourseManagementSystem.java b/CourseManagementSystem.java new file mode 100644 index 0000000..8f59ea8 --- /dev/null +++ b/CourseManagementSystem.java @@ -0,0 +1,70 @@ +class Course { + private String courseName; + private int duration; // duration in months + private double fee; + private static String instituteName = ""; + + // Constructor + public Course(String courseName, int duration, double fee) { + this.courseName = courseName; + this.duration = duration; + this.fee = fee; + } + + // Instance method to display course details + public void displayCourseDetails() { + System.out.println("Institute Name: " + instituteName); + System.out.println("Course Name: " + courseName); + System.out.println("Duration: " + duration + " months"); + System.out.println("Fee: " + fee); + System.out.println("-------------------------"); + } + + // Class method to update institute name + public static void updateInstituteName(String newInstituteName) { + instituteName = newInstituteName; + } +} + +public class CourseManagementSystem { + + public static void main(String[] args) { + // Create instances of Course + Course course1 = new Course("Java Programming", 3, 15000.0); + Course course2 = new Course("Web Development", 6, 20000.0); + + // Display details of each course + course1.displayCourseDetails(); + course2.displayCourseDetails(); + + // Update institute name + Course.updateInstituteName("Code Help"); + + // Display details again after updating institute name + course1.displayCourseDetails(); + course2.displayCourseDetails(); + } +} + +//Sample Output + +//Institute Name: +//Course Name: Java Programming +//Duration: 3 months +//Fee: 15000.0 +// ------------------------- +//Institute Name: +//Course Name: Web Development +//Duration: 6 months +//Fee: 20000.0 +// ------------------------- +//Institute Name: Code Help +//Course Name: Java Programming +//Duration: 3 months +//Fee: 15000.0 +// ------------------------- +//Institute Name: Code Help +//Course Name: Web Development +//Duration: 6 months +//Fee: 20000.0 +// ------------------------- \ No newline at end of file From 468862a4e3f380301b2b6e574ff234597e605f2d Mon Sep 17 00:00:00 2001 From: Manan Gupta Date: Tue, 11 Mar 2025 09:59:50 +0530 Subject: [PATCH 3/3] [Manan] ADD:Created a vehicle registration system and implemented functions like update registration fees --- VehicleRegistration.java | 58 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 VehicleRegistration.java diff --git a/VehicleRegistration.java b/VehicleRegistration.java new file mode 100644 index 0000000..63567c8 --- /dev/null +++ b/VehicleRegistration.java @@ -0,0 +1,58 @@ +public class VehicleRegistration { + + static class Vehicle { + private String ownerName; + private String vehicleType; + private static double registrationFee = 5000.0; + + // Constructor to initialize instance variables + public Vehicle(String ownerName, String vehicleType) { + this.ownerName = ownerName; + this.vehicleType = vehicleType; + } + + // Instance method to display vehicle details + public void displayVehicleDetails() { + System.out.println("Owner Name: " + ownerName); + System.out.println("Vehicle Type: " + vehicleType); + System.out.println("Registration Fee: " + registrationFee); + } + + // Static method to update registration fee + public static void updateRegistrationFee(double newFee) { + registrationFee = newFee; + } + } + + // Main method to test the functionality + public static void main(String[] args) { + // Create instances of Vehicle + Vehicle vehicle1 = new Vehicle("Ramesh", "Car"); + Vehicle vehicle2 = new Vehicle("Suresh", "Motorcycle"); + + // Display details of each vehicle + vehicle1.displayVehicleDetails(); + vehicle2.displayVehicleDetails(); + + // Update registration fee + Vehicle.updateRegistrationFee(6000.0); + + // Display details again after updating registration fee + vehicle1.displayVehicleDetails(); + vehicle2.displayVehicleDetails(); + } +} + +//Sample Output +//Owner Name: Ramesh +//Vehicle Type: Car +//Registration Fee: 5000.0 +//Owner Name: Suresh +//Vehicle Type: Motorcycle +//Registration Fee: 5000.0 +//Owner Name: Ramesh +//Vehicle Type: Car +//Registration Fee: 6000.0 +//Owner Name: Suresh +//Vehicle Type: Motorcycle +//Registration Fee: 6000.0 \ No newline at end of file