Asad - S Group Oop Project

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 10

STEPS

We have taken Three Medicines. (Domel, Risk, Panadol) for the


medical inventory.
First of all we make an interface of Domel and we make two
methods without body because interface has no body and object.
The names of the Methods are:
Domel Sales
Remaining Domel
Now we make a class named Domel Class.
Now Domel Class inherits the Domel interface.
Then we make an interface of Risk and we make two methods
without body because interface has no body and object.
The names of the Methods are:
Risk Sales
Remaining Risk
Now we make a class named Risk Class.
Now Risk Class inherits the Risk interface.
Then we make an interface of Panadol and we make two methods
without body because interface has no body and object.
The names of the methods are:
Panadol Sales
Remaining Panadol
Now we make a class named Panadol Class.
Now Panadol Class inherits the Panadol interface.
In main method we have three choices:
1 for Domel
2 for Risk
3 for Panadol
Depending upon the medicines which the user selects we make
objects of medicines, then we call our method related to that
medicine.

MAIN
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication5
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("\t\t\t***Medical Inventory
System***");
Console.WriteLine("\n\n\t\t\t**Which product do you want
to buy??**");
Console.WriteLine("\n\t1_ for Domel\n\t2_for Risk");
Console.Write("\n\tEnter your Choice:");
int e = int.Parse(Console.ReadLine());
switch (e)
{
case 1:
{
DomelClass a = new DomelClass();
a.DomelSales();
a.RemainingDomel();
break;
}
case 2:
{
RiskClass a = new RiskClass();
a.RiskSales();
a.RemainingRisk();

break;
}
case 3:
{
PanadolClass a = new PanadolClass();
a.PanadolSales();
a.RemainingPanadol();
break;
}
default:
Console.WriteLine("Thank youuuuu");
break;
}
Console.ReadLine();
}
}
}

DOMEL INERFACE
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication5
{
interface Domel
{
void DomelSales();
void RemainingDomel();
}
}

DOMEL CLASS
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication5
{
class DomelClass:Domel
{
int totalNoDomel = 1000;
int priceOfDomel = 10;
public int a, b;
public void DomelSales()
{
Console.WriteLine("Enter The no of Domel ?");
a = int.Parse(Console.ReadLine());
b = a * priceOfDomel;
Console.WriteLine("Purchased Domel are :" + a);
Console.WriteLine("You have to pay Rs" + b + " for " + a);
}
public void RemainingDomel()
{
int d = totalNoDomel - a;
Console.WriteLine("Remaining Domel are :" + d);
}
}
}

RISK INTERFACE
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication5
{
interface Risk
{
void RiskSales();
void RemainingRisk();
}
}

RISK CLASS
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication5
{
class RiskClass:Risk
{
int totalNoRisk = 1000;
int priceOfRisk = 14;
public int a, b;
public void RiskSales()
{
Console.WriteLine("Enter The no of Risk ?");
a = int.Parse(Console.ReadLine());
b = a * priceOfRisk;
Console.WriteLine("Purchased Risk are :" + a);
Console.WriteLine("You have to pay Rs" + b + " for " + a);
}
public void RemainingRisk()
{
int d = totalNoRisk - a;
Console.WriteLine("Remaining Risk are :" + d);
}
}
}

PANADOL INTERFACE
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication5
{
interface Panadol
{
void PanadolSales();
void RemainingPanadol();
}
}

PANADOL CLASS
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication5
{
class PanadolClass : Panadol
{
int totalNoPanadol = 1000;
int priceOfPanadol = 2;
public int a, b;
public void PanadolSales()
{
Console.WriteLine("\nEnter The no of Panadol ?");
a = int.Parse(Console.ReadLine());
b = a * priceOfPanadol;
Console.WriteLine("Purchased Panadol are :" + a);
Console.WriteLine("You have to pay Rs" + b + " for " + a);
}
public void RemainingPanadol()
{
int d = totalNoPanadol - a;
Console.WriteLine("Remaining Panadols are :" + d);
Console.WriteLine("\n\n\t\t\t**** Thank Y0u**** :)");
}
}

You might also like