//----------------------------------------------------Scenario 1
------------------------------------------------------------------
//----------------------------------------------------Answer # 1
---------------------------------------------------------//
//using System;
//public class Product
//{
// public string Name { get; set; }
// public decimal Price { get; set; }
// public int Stock { get; set; }
// public Product(string name, decimal price, int stock)
// {
// Name = name;
// Price = price;
// Stock = stock;
// }
// public bool IsInStock()
// {
// return Stock > 0;
// }
//}
//class Program
//{
// static void Main(string[] args)
// {
// Product product = new Product("computer", 999.99m, 15);
// Console.WriteLine($"Product: {product.Name}");
// Console.WriteLine($"Price: {product.Price}");
// Console.WriteLine($"Stock: {product.Stock}");
// Console.WriteLine($"Is in stock: {product.IsInStock()}");
// }
//}
//----------------------------------------------------Scenario 1
------------------------------------------------------------------
//----------------------------------------------------Answer # 2
---------------------------------------------------------//
//using System;
//public class Customer
//{
// public string Name { get; set; }
// public string Email { get; set; }
// public Customer(string name, string email)
// {
// Name = name;
// Email = email;
// }
//}
//class Program
//{
// static void Main(string[] args)
// {
// Customer customer = new Customer("Abrar Patel", "abrar@gmail.com");
// Console.WriteLine("Customer Name: " + customer.Name);
// Console.WriteLine("Customer Email: " + customer.Email);
// }
//}
//----------------------------------------------------Scenario 1
------------------------------------------------------------------
//--------------------------------------------------------------Answer #
3---------------------------------------------------------
//using System;
//using System.Collections.Generic;
//public class Product
//{
// public string Name { get; set; }
// public decimal Price { get; set; }
// public int Stock { get; set; }
// public Product(string name, decimal price, int stock)
// {
// Name = name;
// Price = price;
// Stock = stock;
// }
// public bool ReduceStock(int quantity)
// {
// if (Stock >= quantity)
// {
// Stock -= quantity;
// return true;
// }
// return false;
// }
//}
//public class Customer
//{
// public string Name { get; set; }
// public string Email { get; set; }
// public Customer(string name, string email)
// {
// Name = name;
// Email = email;
// }
//}
//public class Order
//{
// public int OrderId { get; set; }
// public Customer Customer { get; set; }
// public List<(Product Product, int Quantity)> Products { get; set; }
// public Order(int orderId, Customer customer)
// {
// OrderId = orderId;
// Customer = customer;
// Products = new List<(Product, int)>();
// }
// public void AddProduct(Product product, int quantity)
// {
// if (product.ReduceStock(quantity))
// {
// Products.Add((product, quantity));
// }
// }
// public decimal CalculateTotal()
// {
// decimal total = 0;
// foreach (var item in Products)
// {
// total += item.Product.Price * item.Quantity;
// }
// return total;
// }
//}
//class Program
//{
// static void Main(string[] args)
// {
// Customer customer = new Customer("Abrar patel", "abr@gmail.com");
// Product product1 = new Product("Laptop", 1000m, 10);
// Product product2 = new Product("Phone", 500m, 20);
// Order order = new Order(1, customer);
// order.AddProduct(product1, 2);
// order.AddProduct(product2, 1);
// Console.WriteLine("Order Total: " + order.CalculateTotal());
// Console.WriteLine("Remaining Stock of Laptop: " + product1.Stock);
// Console.WriteLine("Remaining Stock of Phone: " + product2.Stock);
// }
//}
//----------------------------------------------------Scenario 1
------------------------------------------------------------------
//--------------------------------------------------------------Answer #
4---------------------------------------------------------
//using System;
//public class Product
//{
// public string Name { get; set; }
// public decimal Price { get; set; }
// public int Stock { get; set; }
// public Product(string name, decimal price, int stock)
// {
// Name = name;
// Price = price;
// Stock = stock;
// }
// public bool Purchase(int quantity)
// {
// if (quantity <= Stock)
// {
// Stock -= quantity;
// return true;
// }
// return false;
// }
//}
//public class Customer
//{
// public int CustomerId { get; set; }
// public string Name { get; set; }
// public Customer(int customerId, string name)
// {
// CustomerId = customerId;
// Name = name;
// }
//}
//public class Order
//{
// public Product Product { get; set; }
// public Customer Customer { get; set; }
// public int Quantity { get; set; }
// public Order(Product product, Customer customer, int quantity)
// {
// Product = product;
// Customer = customer;
// Quantity = quantity;
// }
// public bool ProcessOrder()
// {
// return Product.Purchase(Quantity);
// }
// public void DisplayOrderDetails()
// {
// if (ProcessOrder())
// {
// Console.WriteLine($"Customer: {Customer.Name}");
// Console.WriteLine($"Product: {Product.Name}");
// Console.WriteLine($"Quantity: {Quantity}");
// Console.WriteLine($"Total Price: ${Product.Price * Quantity}");
// Console.WriteLine($"Remaining Stock: {Product.Stock}");
// }
// else
// {
// Console.WriteLine("Not enough stock available.");
// }
// }
//}
//public class Program
//{
// public static void Main()
// {
// Product product = new Product("Laptop", 1000m, 10);
// Customer customer = new Customer(1, "Melisa");
// Order order = new Order(product, customer, 3);
// order.DisplayOrderDetails();
// }
//}
//----------------------------------------------------Scenario 3
------------------------------------------------------------------
//-------------------------------------------------------Answer # 1
------------------------------------------------------------------------//
//public class Vehicle
//{
// public string Make { get; set; }
// public string Model { get; set; }
// public decimal RentalPricePerDay { get; set; }
// public Vehicle(string make, string model, decimal rentalPricePerDay)
// {
// Make = make;
// Model = model;
// RentalPricePerDay = rentalPricePerDay;
// }
//}
//public class Car : Vehicle
//{
// public int NumberOfDoors { get; set; }
// public bool IsAutomatic { get; set; }
// public Car(string make, string model, decimal rentalPricePerDay, int
numberOfDoors, bool isAutomatic)
// : base(make, model, rentalPricePerDay)
// {
// NumberOfDoors = numberOfDoors;
// IsAutomatic = isAutomatic;
// }
//}
//public class Bike : Vehicle
//{
// public bool HasCarrier { get; set; }
// public Bike(string make, string model, decimal rentalPricePerDay, bool
hasCarrier)
// : base(make, model, rentalPricePerDay)
// {
// HasCarrier = hasCarrier;
// }
//}
//class Program
//{
// static void Main(string[] args)
// {
// Car car = new Car("Toyota", "Camry", 50.00m, 4, true);
// Bike bike = new Bike("Yamaha", "MT-07", 30.00m, true);
// Console.WriteLine("Car Details:");
// Console.WriteLine($"Make: {car.Make}");
// Console.WriteLine($"Model: {car.Model}");
// Console.WriteLine($"Rental Price Per Day: ${car.RentalPricePerDay}");
// Console.WriteLine($"Number of Doors: {car.NumberOfDoors}");
// Console.WriteLine($"Is Automatic: {car.IsAutomatic}");
// Console.WriteLine("\nBike Details:");
// Console.WriteLine($"Make: {bike.Make}");
// Console.WriteLine($"Model: {bike.Model}");
// Console.WriteLine($"Rental Price Per Day: ${bike.RentalPricePerDay}");
// Console.WriteLine($"Has Carrier: {bike.HasCarrier}");
// }
//}
//----------------------------------------------------Scenario 3
------------------------------------------------------------------
//-------------------------------------------------------Answer # 2
------------------------------------------------------------------------//
//public class Customer
//{
// public string Name { get; set; }
// public string DrivingLicenseNumber { get; set; }
// public Customer(string name, string drivingLicenseNumber)
// {
// Name = name;
// DrivingLicenseNumber = drivingLicenseNumber;
// }
// public void DisplayCustomerInfo()
// {
// Console.WriteLine($"Customer Name: {Name}");
// Console.WriteLine($"Driving License Number: {DrivingLicenseNumber}");
// }
//}
//class Program
//{
// static void Main(string[] args)
// {
// Customer customer = new Customer("John Doe", "DL123456");
// customer.DisplayCustomerInfo();
// }
//}
//----------------------------------------------------Scenario 3
------------------------------------------------------------------
//-------------------------------------------------------Answer # 3
------------------------------------------------------------------------//
//using System;
//public class Vehicle
//{
// public int VehicleId { get; set; }
// public string Model { get; set; }
// public decimal DailyRate { get; set; }
// public Vehicle(int vehicleId, string model, decimal dailyRate)
// {
// VehicleId = vehicleId;
// Model = model;
// DailyRate = dailyRate;
// }
//}
//public class Customer
//{
// public int CustomerId { get; set; }
// public string Name { get; set; }
// public string ContactInfo { get; set; }
// public Customer(int customerId, string name, string contactInfo)
// {
// CustomerId = customerId;
// Name = name;
// ContactInfo = contactInfo;
// }
//}
//public class Rental
//{
// public Vehicle Vehicle { get; set; }
// public Customer Customer { get; set; }
// public DateTime RentalStartDate { get; set; }
// public DateTime RentalEndDate { get; set; }
// public Rental(Vehicle vehicle, Customer customer, DateTime rentalStartDate,
DateTime rentalEndDate)
// {
// Vehicle = vehicle;
// Customer = customer;
// RentalStartDate = rentalStartDate;
// RentalEndDate = rentalEndDate;
// }
// public decimal CalculateTotalCost()
// {
// int rentalPeriod = (RentalEndDate - RentalStartDate).Days;
// if (rentalPeriod < 0)
// {
// throw new ArgumentException("Rental end date cannot be before rental
start date.");
// }
// return rentalPeriod * Vehicle.DailyRate;
// }
//}
//public class Program
//{
// public static void Main()
// {
// Vehicle vehicle = new Vehicle(1, "Toyota Camry", 50);
// Customer customer = new Customer(1, "John Doe", "john@example.com");
// DateTime rentalStartDate = new DateTime(2024, 12, 1);
// DateTime rentalEndDate = new DateTime(2024, 12, 5);
// Rental rental = new Rental(vehicle, customer, rentalStartDate,
rentalEndDate);
// decimal totalCost = rental.CalculateTotalCost();
// Console.WriteLine($"Total rental cost: ${totalCost}");
// }
//}
//----------------------------------------------------Scenario 3
------------------------------------------------------------------
//-------------------------------------------------------Answer #
4------------------------------------------------------------------------//
//using System;
//public class Vehicle
//{
// public int VehicleId { get; set; }
// public string Model { get; set; }
// public decimal DailyRate { get; set; }
// public Vehicle(int vehicleId, string model, decimal dailyRate)
// {
// VehicleId = vehicleId;
// Model = model;
// DailyRate = dailyRate;
// }
//}
//public class Customer
//{
// public int CustomerId { get; set; }
// public string Name { get; set; }
// public string ContactInfo { get; set; }
// public Customer(int customerId, string name, string contactInfo)
// {
// CustomerId = customerId;
// Name = name;
// ContactInfo = contactInfo;
// }
//}
//public class Rental
//{
// public Vehicle Vehicle { get; set; }
// public Customer Customer { get; set; }
// public DateTime RentalStartDate { get; set; }
// public DateTime RentalEndDate { get; set; }
// public Rental(Vehicle vehicle, Customer customer, DateTime rentalStartDate,
DateTime rentalEndDate)
// {
// Vehicle = vehicle;
// Customer = customer;
// RentalStartDate = rentalStartDate;
// RentalEndDate = rentalEndDate;
// }
// public decimal CalculateTotalCost()
// {
// int rentalPeriod = (RentalEndDate - RentalStartDate).Days;
// return rentalPeriod * Vehicle.DailyRate;
// }
// public void DisplayRentalDetails()
// {
// Console.WriteLine($"Customer: {Customer.Name}");
// Console.WriteLine($"Vehicle: {Vehicle.Model}");
// Console.WriteLine($"Rental Period: {RentalStartDate.ToShortDateString()}
to {RentalEndDate.ToShortDateString()}");
// Console.WriteLine($"Total Cost: ${CalculateTotalCost()}");
// }
//}
//public class Program
//{
// public static void Main()
// {
// Vehicle vehicle = new Vehicle(1, "Toyota Camry", 50);
// Customer customer = new Customer(1, "John Doe", "john@example.com");
// DateTime rentalStartDate = new DateTime(2024, 12, 1);
// DateTime rentalEndDate = rentalStartDate.AddDays(5);
// Rental rental = new Rental(vehicle, customer, rentalStartDate,
rentalEndDate);
// rental.DisplayRentalDetails();
// }
//}