Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Problem Statement 1/BasicUtility/Program.cs
Original file line number Diff line number Diff line change
@@ -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");
}
}
}
21 changes: 21 additions & 0 deletions Problem Statement 1/BasicUtility/Utility.cs
Original file line number Diff line number Diff line change
@@ -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);
}
}
}
27 changes: 27 additions & 0 deletions Problem Statement 1/Problem Statement 1.java
Original file line number Diff line number Diff line change
@@ -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");
}
}
22 changes: 22 additions & 0 deletions Problem Statement 2/InventoryManagementSystem/InventoryManager.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
namespace InventoryManagementSystem
{
public class InventoryManager
{
private List<Product> inventory;

public InventoryManager()
{
this.inventory = new List<Product>();
}

public void AddProduct(Product product)
{
inventory.Add(product);
}

public List<Product> GetInventory()
{
return inventory;
}
}
}
16 changes: 16 additions & 0 deletions Problem Statement 2/InventoryManagementSystem/Product.cs
Original file line number Diff line number Diff line change
@@ -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;
}
}
}
56 changes: 56 additions & 0 deletions Problem Statement 2/InventoryManagementSystem/Program.cs
Original file line number Diff line number Diff line change
@@ -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<Product> 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;
}
}
}
}
}
97 changes: 97 additions & 0 deletions Problem Statement 2/Problem Statement 2.java
Original file line number Diff line number Diff line change
@@ -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<a> k;

public j() {
this.k = new ArrayList<>();
}

public void l(a m) {
k.add(m);
}

public List<a> 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<a> 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.");
}
}
}
}