Skip to content
Open
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
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "week1"]
path = week1
url = https://github.com/pawankhandwe/four-weeks-training.git
1 change: 1 addition & 0 deletions week-1/day-1/HelloWorldApp
Submodule HelloWorldApp added at 6bbd86
15 changes: 15 additions & 0 deletions week-1/day-2/exercise-1/Circle/Circle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,20 @@ namespace Circle
internal class Circle
{
// Implement the Circle class here

int radius;
public Circle(int Radius)
{
radius = Radius;
}
public double getArea()
{

return Math.PI * Math.Pow(radius, 2);
}
public double GetCircumference()
{
return 2 * Math.PI * radius;
}
}
}
3 changes: 3 additions & 0 deletions week-1/day-2/exercise-1/Circle/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ internal class Program
static void Main(string[] args)
{
// Create a Circle object and display its area and circumference
Circle c = new Circle(3);
Console.WriteLine("area of circle is " + c.getArea());
Console.WriteLine("Circumference of circle is " + c.GetCircumference());
}
}
}
164 changes: 161 additions & 3 deletions week-1/day-2/exercise-2/BankAccount/Program.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,168 @@
namespace BankAccount
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

{
internal class Program
public abstract class BankAccount
{
protected Int64 AccountNumber = 326002120001175;
public Int32 Balance = 30000;

protected abstract void Deposit();
protected abstract void Withdraw();
static void Main(string[] args)
{
// Create SavingsAccount and CheckingAccount objects and perform operations
Console.WriteLine("bank account");

CheckingAccount account = new CheckingAccount();

account.Withdraw();
account.Deposit();

SavingsAccount savingsAccount = new SavingsAccount();
savingsAccount.Withdraw();
savingsAccount.Deposit();
}
}
}

public class CheckingAccount : BankAccount
{
private int OverdraftLimit = 10000;
public Int32 Checkbalance;
public CheckingAccount()
{
Checkbalance = Balance;
Console.WriteLine("Account Balance is" + Checkbalance);

}
protected override void Deposit()
{

Console.WriteLine("how much you want to Deposit In current account");
Int32 Money = Convert.ToInt32(Console.ReadLine());
Boolean flg = false;
if (OverdraftLimit >= Money)
{
Checkbalance = Checkbalance + Money;
flg = true;
}
else
{
flg = false;
}
if (flg)
{

Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("Your Deposit sucessful!! ");
Console.ResetColor();
Console.WriteLine("Your current account balance is " + Checkbalance);
}
else
{

Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("Your Deposit failed!! ");
Console.ResetColor();
}
}
protected override void Withdraw()
{
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine("how much you want to withdraw from current account");
Console.ResetColor();
Int32 Money = Convert.ToInt32(Console.ReadLine());
Boolean flag = false;
if (OverdraftLimit >= Money)
{
flag = true;
Checkbalance = Checkbalance - Money;
}
else
{
flag = false;
}
if (flag)
{

Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("WITHDRAW SUCESSFUL !! ");
Console.ResetColor();
Console.WriteLine("Your current account balance is " + Checkbalance);
}
else
{

Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("WITHDRAW failed !! "); Console.ResetColor();
}
}
}
class SavingsAccount : BankAccount
{
private int InterestRate;
private int OverdraftLimits = 10000;
public Int32 Checkbal;
public SavingsAccount()
{
Checkbal = Balance;
}
protected override void Deposit()
{
Console.WriteLine("how much you want to Deposit In saving account");
int Money = Convert.ToInt32(Console.ReadLine());
Boolean flg = false;
if (OverdraftLimits >= Money)
{
flg = true;
Checkbal = Checkbal + Money;
}
else
{
flg = false;
}
if (flg)
{
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("Your Deposit sucessful!! "); Console.ResetColor();
Console.WriteLine("Your current account balance is " + Checkbal);
}
else
{

Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("Your Deposit failed !!"); Console.ResetColor();
}
}
protected override void Withdraw()
{
Console.WriteLine("how much you want to withdraw In saving account");
int Money = Convert.ToInt32(Console.ReadLine());
bool flg = false;
if (OverdraftLimits >= Money)
{
flg = true;
Checkbal = Checkbal - Money;
}
else
{
flg = false;
}
if (flg)
{
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("withdraw sucessful!!"); Console.ResetColor();
Console.WriteLine("Your current account balance is " + Checkbal);
}
else
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("WITHDRAW failed !! "); Console.ResetColor();
}
}
}

}
61 changes: 60 additions & 1 deletion week-1/day-2/exercise-3/AnimalExercise/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,65 @@ internal class Program
static void Main(string[] args)
{
// Create a list of Animal objects, add Dog and Cat instances, and call their methods
String Name;
int Age;
protected abstract void MakeSound();

static void Main(string[] args)
{
Console.WriteLine("animals");
List<Animal> animals = new List<Animal>();

Dog dog = new Dog { Name = "lebradog", Age = 3 };
Dog dog2 = new Dog { Name = "bulldog", Age = 7 };
Cat cat = new Cat { Name = "whisky", Age = 2 };
Cat cat2 = new Cat { Name = "billi", Age = 2 };

animals.Add(dog);
animals.Add(dog2);
animals.Add(cat);
animals.Add(cat2);

foreach (var animal in animals)
{
Console.WriteLine("Name:" + animal.Name + " , Age: " + animal.Age);

animal.MakeSound();

if (animal is IMovable movable)
{
movable.move();
}

}
}
}


class Dog : Animal, IMovable
{
protected override void MakeSound()
{
Console.WriteLine("Woof");
}
public void move()
{
Console.WriteLine("dog is moving .");
}
}
}
class Cat : Animal, IMovable
{
protected override void MakeSound()
{
Console.WriteLine("Meow");
}
public void move()
{
Console.WriteLine("cat is moving .");
}
}
interface IMovable
{
public void move();
}
}
Loading