diff --git a/Problem Statement 1/BasicUtility/Program.cs b/Problem Statement 1/BasicUtility/Program.cs new file mode 100644 index 0000000..6ecc5c6 --- /dev/null +++ b/Problem Statement 1/BasicUtility/Program.cs @@ -0,0 +1,16 @@ +namespace BasicUtility +{ + internal class Program + { + static void Main(string[] args) + { + Utility utilityObject = new Utility(); + utilityObject.Operand = 10; + utilityObject.DecimalValue = 20.5; + utilityObject.ConvertedText = "hello"; + + utilityObject.CalculateSum(utilityObject.Operand, 5); + utilityObject.ConvertToUpperCase("world"); + } + } +} diff --git a/Problem Statement 1/BasicUtility/Utility.cs b/Problem Statement 1/BasicUtility/Utility.cs new file mode 100644 index 0000000..9bb989d --- /dev/null +++ b/Problem Statement 1/BasicUtility/Utility.cs @@ -0,0 +1,21 @@ +namespace BasicUtility +{ + public class Utility + { + public int Operand { get; set; } + public double DecimalValue { get; set; } + public string ConvertedText { get; set; } + + public void CalculateSum(int input1, int input2) + { + int sum = input1 + input2; + Console.WriteLine("Sum: " + sum); + } + + public void ConvertToUpperCase(string inputText) + { + ConvertedText = inputText.ToUpper(); + Console.WriteLine("Uppercase String: " + ConvertedText); + } + } +} diff --git a/Problem Statement 1/Problem Statement 1.java b/Problem Statement 1/Problem Statement 1.java new file mode 100644 index 0000000..49f56f0 --- /dev/null +++ b/Problem Statement 1/Problem Statement 1.java @@ -0,0 +1,27 @@ +public class xyz { + int a; + double b; + String c; + + public void m1(int x, int y) { + int z = x + y; + System.out.println("Result: " + z); + } + + public void m2(String p) { + c = p.toUpperCase(); + System.out.println("Updated String: " + c); + } +} + +public class abc { + public static void main(String[] args) { + xyz obj = new xyz(); + obj.a = 10; + obj.b = 20.5; + obj.c = "hello"; + + obj.m1(obj.a, 5); + obj.m2("world"); + } +} \ No newline at end of file diff --git a/Problem Statement 2/InventoryManagementSystem/InventoryManager.cs b/Problem Statement 2/InventoryManagementSystem/InventoryManager.cs new file mode 100644 index 0000000..8291675 --- /dev/null +++ b/Problem Statement 2/InventoryManagementSystem/InventoryManager.cs @@ -0,0 +1,22 @@ +namespace InventoryManagementSystem +{ + public class InventoryManager + { + private List inventory; + + public InventoryManager() + { + this.inventory = new List(); + } + + public void AddProduct(Product product) + { + inventory.Add(product); + } + + public List GetInventory() + { + return inventory; + } + } +} diff --git a/Problem Statement 2/InventoryManagementSystem/Product.cs b/Problem Statement 2/InventoryManagementSystem/Product.cs new file mode 100644 index 0000000..0fe89eb --- /dev/null +++ b/Problem Statement 2/InventoryManagementSystem/Product.cs @@ -0,0 +1,16 @@ +namespace InventoryManagementSystem +{ + public class Product + { + public string Name { get; set; } + public double Price { get; set; } + public int Quantity { get; set; } + + public Product(string name, double price, int quantity) + { + Name = name; + Price = price; + Quantity = quantity; + } + } +} diff --git a/Problem Statement 2/InventoryManagementSystem/Program.cs b/Problem Statement 2/InventoryManagementSystem/Program.cs new file mode 100644 index 0000000..7a9c1c4 --- /dev/null +++ b/Problem Statement 2/InventoryManagementSystem/Program.cs @@ -0,0 +1,56 @@ +namespace InventoryManagementSystem +{ + internal class Program + { + static void Main(string[] args) + { + InventoryManager inventoryManager = new InventoryManager(); + + while (true) + { + Console.WriteLine("\nInventory Management System"); + Console.WriteLine("1. Add Product"); + Console.WriteLine("2. Display Inventory"); + Console.WriteLine("3. Exit"); + Console.Write("Enter your choice: "); + + int choice = Convert.ToInt32(Console.ReadLine()); + + switch (choice) + { + case 1: + Console.Write("Enter product name: "); + string name = Console.ReadLine(); + Console.Write("Enter product price: "); + double price = Convert.ToDouble(Console.ReadLine()); + Console.Write("Enter product quantity: "); + int quantity = Convert.ToInt32(Console.ReadLine()); + + Product product = new Product(name, price, quantity); + inventoryManager.AddProduct(product); + + Console.WriteLine("Product added successfully!"); + break; + + case 2: + Console.WriteLine("\nCurrent Inventory:"); + List productsInInventory = inventoryManager.GetInventory(); + foreach (Product currentProduct in productsInInventory) + { + Console.WriteLine($"Name: {currentProduct.Name}, Price: ${currentProduct.Price}, Quantity: {currentProduct.Quantity}"); + } + break; + + case 3: + Console.WriteLine("Exiting program. Goodbye!"); + Environment.Exit(0); + break; + + default: + Console.WriteLine("Invalid choice. Please enter a valid option."); + break; + } + } + } + } +} diff --git a/Problem Statement 2/Problem Statement 2.java b/Problem Statement 2/Problem Statement 2.java new file mode 100644 index 0000000..c0f57f0 --- /dev/null +++ b/Problem Statement 2/Problem Statement 2.java @@ -0,0 +1,97 @@ +import java.util.ArrayList; +import java.util.List; +import java.util.Scanner; + +class a { + private String b; + private double c; + private int d; + + public a(String b, double c, int d) { + this.b = b; + this.c = c; + this.d = d; + } + + public String e() { + return b; + } + + public double f() { + return c; + } + + public int g() { + return d; + } + + public void h(int i) { + this.d = i; + } +} + +class j { + private List k; + + public j() { + this.k = new ArrayList<>(); + } + + public void l(a m) { + k.add(m); + } + + public List n() { + return k; + } +} + +public class o { + public static void main(String[] p) { + j q = new j(); + Scanner r = new Scanner(System.in); + + while (true) { + System.out.println("\nInv Mgmt System"); + System.out.println("1. Add Prod"); + System.out.println("2. Display Inv"); + System.out.println("3. Exit"); + System.out.print("Enter your choice: "); + + int s = r.nextInt(); + + switch (s) { + case 1: + System.out.print("Enter prod name: "); + String t = r.next(); + System.out.print("Enter prod price: "); + double u = r.nextDouble(); + System.out.print("Enter prod qty: "); + int v = r.nextInt(); + + a w = new a(t, u, v); + q.l(w); + + System.out.println("Prod added successfully!"); + break; + + case 2: + System.out.println("\nCurrent Inv:"); + List x = q.n(); + for (a y : x) { + System.out.println("Name: " + y.e() + + ", Price: $" + y.f() + + ", Quantity: " + y.g()); + } + break; + + case 3: + System.out.println("Exiting program. Goodbye!"); + System.exit(0); + + default: + System.out.println("Invalid choice. Please enter a valid option."); + } + } + } +} \ No newline at end of file