Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Disclaimer: The creator of 'C# Shell (C# Offline Compiler)' is in no way responsible for the code posted by any user.
- using System;
- using System.IO;
- using System.Linq;
- using System.Collections.Generic;
- namespace CSharp_Shell{
- public class Company{
- private List<Employee>ListEmployee;
- Company(){
- ListEmployee=new List<Employee>();
- ListEmployee.Add(new Employee{Id=1,Name="Abdullah",Gender="Male",Experince=7,Salary=30000});
- ListEmployee.Add(new Employee{Id=1,Name="Aya",Gender="Female",Experince=6,Salary=25000});
- ListEmployee.Add(new Employee{Id=1,Name="Abdelkader",Gender="Male",Experince=5,Salary=300000});
- ListEmployee.Add(new Employee{Id=1,Name="Hanaa",Gender="Female",Experince=4,Salary=20000});
- }
- }
- class Employee{
- string name;
- int id;
- int experince;
- int salary;
- string gender;
- public string Name{
- get{
- return gender;
- }
- set{name=value;}
- }
- public enum Gendero{
- Male,
- Female,
- Unkmnow,
- }
- public string Gender{
- get{
- return gender;}
- set{gender=value;}
- }
- public int Id{
- get{return id;}
- set{id=value;}
- }
- public int Experince{
- get{return experince;}
- set{experince=value;}
- }
- public int Salary{
- get{return salary;}
- set{value=salary;}
- }
- public static void EmoloyeeData(List<Employee>e){
- foreach(Employee employee in e){
- Console.WriteLine(employee.Name);
- }
- }
- public static void prompotoemployee(List<Employee> employeelist,Ispromotable Is){
- foreach(Employee employee in employeelist){
- if(Is(employee)){
- employee.Salary+=5000;
- Console.WriteLine(employee.Name+" Promoto ");
- }
- }
- }
- }
- //*********************End Class Employee*********************************//
- delegate bool Ispromotable(Employee emp);
- abstract class Salary{
- public abstract int salary(int x);
- }
- class Customer:Salary{
- string name;
- string adress;
- string phone;
- string id;
- int age;
- public override int salary(int x){
- int result=x;
- return result;
- }
- public string Name{
- get{return name;}
- set{name=value;}
- }
- public int Age{
- get{return age;}
- set{age=value;}
- }
- public string Adress{
- get{return adress;}
- set{adress=value;}
- }
- public string Phone{
- get{return phone;}
- set{phone=value;}
- }
- public string Id{
- get{return id;}
- set{id=value;}
- }
- public void EnterData(){
- go:
- Console.WriteLine("Please Enter Youre Name");
- Name=Console.ReadLine();
- Console.WriteLine("Please Enter Youre Adress");
- Adress=Console.ReadLine();
- Console.WriteLine("Please Enter Youre Phone");
- Phone=Console.ReadLine();
- Console.WriteLine("Please Enter Youre Id");
- Id=Console.ReadLine();
- Console.WriteLine("Please Enter Youre Age");
- Age=int.Parse(Console.ReadLine());
- if(Age>=22){
- Console.WriteLine(" Accepted");
- Console.WriteLine(" ");
- }else{
- Console.WriteLine("Not Accepted");
- goto go;
- }
- }
- public void ShowData(){
- Console.WriteLine("Name :{0}",Name);
- Console.WriteLine("Adress :{0}",Adress);
- Console.WriteLine("Phone :{0}",Phone);
- Console.WriteLine("Id :{0}",Id);
- Console.WriteLine("Age :{0}",Age);
- // use abstrac class
- //Console.WriteLine("Salary :{0} ",salary(30000));
- }
- interface I1{
- bool start(bool x);
- void Fore();
- void back();
- void right();
- void left();
- }
- interface I2{
- bool start(bool x);
- void Fore();
- void back();
- void right();
- void left();
- }
- class Car:I1,I2{
- protected string prand;
- protected string name;
- protected int speed;
- protected string color;
- protected int price;
- bool I1.start(bool val){
- bool result=val;
- if(result== true){
- Console.WriteLine("Car Is On");
- }else{Console.WriteLine("Car is Close");}
- return result;
- }
- void I1.Fore(){
- Console.WriteLine("Care Is Fore In The Ground");
- }
- void I1.back(){
- Console.WriteLine("Csr Is Back In The Ground");
- }
- void I1.right(){
- Console.WriteLine(" Car Is Right In The Ground");
- }
- void I1.left(){
- Console.WriteLine("Car Is Left In The Ground");
- }
- bool I2.start(bool val){
- bool result=val;
- if(result== true){
- Console.WriteLine("Car Is On");
- }else{Console.WriteLine("Car is Close");}
- return result;
- }
- void I2.Fore(){
- Console.WriteLine("Care Is Fore In The Air");
- }
- void I2.back(){
- Console.WriteLine("Csr Is Back In The Air");
- }
- void I2.right(){
- Console.WriteLine(" Car Is Right In The Air");
- }
- void I2.left(){
- Console.WriteLine("Car Is Left In The Air");
- }
- public void Type(){
- Console.WriteLine("1.Bmw");
- Console.WriteLine("2.Fiate");
- Console.WriteLine("3.Marcides");
- Console.WriteLine("Enter the nurber of the car if you want to view the details of this car");
- }
- public string Name{
- get{return name;}
- set{value=name;}
- }
- public int Speed{
- get{ return speed;}
- set{ speed=value;}
- }
- public string Color{
- get{return color;}
- set{color=value;}
- }
- public int Price{
- get{return price;}
- set{ price=value;}
- }
- public string Prand{
- get{return prand;}
- set{prand=value;}
- }
- public void Bmw(){}
- public Car(string _name,string _color,string _prand,int _speed,int _price){
- name=_name;
- color=_color;
- prand=_prand;
- speed=_speed;
- price=_price;
- }
- // public Car(string _name):this(null,0,0,string _name){
- // name=_name;
- // }
- public Car(string _name,string _color,int _speed){
- name=_name;
- color=_color;
- speed=_speed;
- price=0;
- }
- public Car(string _name,string _color){
- name=_name;
- color=_color;
- speed=0;
- price=0;
- }
- public Car(string _name){
- name=_name;
- color=null;
- speed=0;
- price=0;
- }
- public Car(){
- }
- public void details(){
- Console.WriteLine(" Nmae :"+Name);
- Console.WriteLine("Color :"+Color);
- Console.WriteLine("Brand :"+Prand);
- Console.WriteLine("Speed :"+Speed);
- Console.WriteLine("Price :"+Price+"$");
- }
- }
- class Bmw:Car{
- public Bmw(string _name,string _color,string _prand,int _speed,int _price){
- name=_name;
- color=_color;
- prand=_prand;
- speed=_speed;
- price=_price;
- }
- // public Car(string _name):this(null,0,0,string _name){
- // name=_name;
- // }
- public Bmw(string _name,string _color,int _speed){
- name=_name;
- color=_color;
- speed=_speed;
- price=0;
- }
- public Bmw(string _name,string _color){
- name=_name;
- color=_color;
- speed=0;
- price=0;
- }
- public Bmw(string _name){
- name=_name;
- color=null;
- speed=0;
- price=0;
- }
- public Bmw(){
- }
- }
- class Fiat:Car{
- public Fiat(string _name,string _color,string _prand,int _speed,int _price){
- name=_name;
- color=_color;
- prand=_prand;
- speed=_speed;
- price=_price;
- }
- /*public Car(string _name):this(null,0,0,string _name){
- name=_name;
- }*/
- public Fiat(string _name,string _color,int _speed){
- name=_name;
- color=_color;
- speed=_speed;
- price=0;
- }
- public Fiat(string _name,string _color){
- name=_name;
- color=_color;
- speed=0;
- price=0;
- }
- public Fiat(string _name){
- name=_name;
- color=null;
- speed=0;
- price=0;
- }
- public Fiat(){
- }
- }
- class Marcides:Car{
- public Marcides(string _name,string _color,string _prand,int _speed,int _price){
- name=_name;
- color=_color;
- prand=_prand;
- speed=_speed;
- price=_price;
- }
- /* public Car(string _name):this(null,0,0,string _name){
- name=_name;
- }*/
- public Marcides(string _name,string _color,int _speed){
- name=_name;
- color=_color;
- speed=_speed;
- price=0;
- }
- public Marcides(string _name,string _color){
- name=_name;
- color=_color;
- speed=0;
- price=0;
- }
- public Marcides(string _name){
- name=_name;
- color=null;
- speed=0;
- price=0;
- }
- public Marcides(){
- }
- }
- class Tsla:Car{
- public Tsla(string _name,string _color,string _prand,int _speed,int _price){
- name=_name;
- color=_color;
- prand=_prand;
- speed=_speed;
- price=_price;
- }
- /*public Car(string _name):this(null,0,0,string _name){
- name=_name;
- }*/
- public Tsla(string _name,string _color,int _speed){
- name=_name;
- color=_color;
- speed=_speed;
- price=0;
- }
- public Tsla(string _name,string _color){
- name=_name;
- color=_color;
- speed=0;
- price=0;
- }
- public Tsla(string _name){
- name=_name;
- color=null;
- speed=0;
- price=0;
- }
- public Tsla(){
- }
- }
- public static class Program
- {
- public static void Main(){
- {
- char p;
- bool val=true;
- Console.ForegroundColor=ConsoleColor.Green;
- Customer c=new Customer();
- Car c1=new Car();
- Bmw b=new Bmw("Bmw","Black","Bmw22",500,1000000);
- Tsla t=new Tsla("Tsal","White","Tsla220",600,250000);
- Fiat f=new Fiat("Fiat","White","Fiat2344",400,500000);
- Marcides r=new Marcides("Marcides","red","Marcides55",300,300000);
- do{
- Console.WriteLine(" Sair In Our Ajance");
- Console.WriteLine("Please Choicese Nurber");
- Console.WriteLine("1.Enter My Data");
- Console.WriteLine("2.Show My Data");
- Console.WriteLine("3.Type Cars");
- Console.WriteLine("4.Test"+ " >>>>> Not Complete ");
- Console.WriteLine("5.Employee"+" >>>>>> "+"Not Complete");
- Console.WriteLine("6.Exite");
- int n=int.Parse(Console.ReadLine());
- switch(n){
- case 1:
- Console.Clear();
- c.EnterData();
- Console.WriteLine("Do you want retun any Event Y/N!?");
- p=char.Parse(Console.ReadLine());
- if(p=='Y'){
- Console.Clear();
- val=true;
- }else{Console.Clear();
- val=false;
- goto s;
- }
- break;
- Console.Clear();
- case 2:
- Console.Clear();
- c.ShowData();
- Console.WriteLine("Do you want retun any Event Y/N!?");
- p=char.Parse(Console.ReadLine());
- if(p=='Y'){
- Console.Clear();
- val=true;
- }else{Console.Clear();
- val=false;
- goto s;
- }
- break;
- case 3:
- bool Vale=true;
- char k;
- Console.Clear();
- do{
- Console.WriteLine("1.Bmw");
- Console.WriteLine("2.Fiate");
- Console.WriteLine("3.Marcides");
- Console.WriteLine("4.Tsla");
- Console.WriteLine("Enter the nurber of the car if you want to view the details of this car");
- int no=int.Parse(Console.ReadLine());
- //ineer Switc
- switch(no){
- case 1:
- ///}}}}}}
- Console.Clear();
- Console.WriteLine("1-Details");
- Console.WriteLine("2-Test");
- int nu=int.Parse(Console.ReadLine());
- b.details();
- Console.WriteLine("Do You Want To return ");
- k=char.Parse(Console.ReadLine());
- if(k=='Y'){
- Console.Clear();
- Vale=true;
- }else{Console.Clear();
- Vale=false;}
- break;
- ////////
- case 2:
- Console.Clear();
- f.details();
- Console.WriteLine("Do You Want To return ");
- k=char.Parse(Console.ReadLine());
- if(k=='Y'){
- Console.Clear();
- Vale=true;
- }else{Console.Clear();
- Vale=false;}
- break;
- case 3:
- Console.Clear();
- r.details();
- Console.WriteLine("Do You Want To return ");
- k=char.Parse(Console.ReadLine());
- if(k=='Y'){
- Console.Clear();
- Vale=true;
- }else{Console.Clear();
- Vale=false;}
- break;
- case 4:
- Console.Clear();
- t.details();
- Console.WriteLine("Do You Want To return ");
- k=char.Parse(Console.ReadLine());
- if(k=='Y'){
- Console.Clear();
- Vale=true;
- }else{Console.Clear();
- Vale=false;}
- break;
- default:
- Console.WriteLine(" Are you stupid I'r saying you choose a nurber of choices");
- Console.WriteLine("Do You Want To retun Y/N!?");
- k=char.Parse(Console.ReadLine());
- if(k=='Y'){
- Console.Clear();
- Vale=true;
- }else{Console.Clear();
- Vale=false;}
- Console.WriteLine("Do You Want To retun Y/N!?");
- p=char.Parse(Console.ReadLine());
- if(p=='Y'){
- Console.Clear();
- val=true;
- }else{Console.Clear();
- val=false;
- goto s;
- }
- Console.WriteLine("GodLuck Sair");
- break;
- }
- }while(Vale);
- break;
- case 4:
- Console.Clear();
- I1 i=new Car();
- i.Fore();
- Car c8=new Car();
- ((I1)c8).back();
- I2 a=new Car();
- a.right();
- ((I2)a).left();
- i.start(true);
- a.start(false);
- break;
- case 5:
- Console.Clear();
- List<Employee>emp=new List<Employee>();
- emp.Add(new Employee{Id=10,Name="Abdullah",Salary=30000,Experince=7});
- emp.Add(new Employee{Id=11,Name="Abdelkader",Salary=250000,Experince=6});
- emp.Add(new Employee{Id=12,Name="Ahmed",Salary=20000,Experince=5});
- emp.Add(new Employee{Id=13,Name="Mazen",Salary=15000,Experince=4});
- emp.Add(new Employee{Id=14,Name="Khaled",Salary=10000,Experince=3});
- static bool promoto(Employee e){
- if(e.Experince>=5){
- return true;
- }else{
- return false;
- }
- }
- Ispromotable Is=new Ispromotable(promoto);
- Employee.prompotoemployee(emp,Is);
- break;
- case 6:
- s:
- Console.Clear();
- Console.WriteLine("Goud Luck Sair...");
- val=false;
- break;
- default:
- Console.Clear();
- Console.WriteLine(" Are you stupid I'r saying you choose a nurber of choices");
- Console.WriteLine("Do You Want To retun Y/N!?");
- p=char.Parse(Console.ReadLine());
- if(p=='Y'){
- Console.Clear();
- val=true;
- }else{Console.Clear();
- val=false;
- goto s;
- }
- Console.WriteLine("GodLuck Sair");
- break;
- }
- }while(val);
- // Use Interfase
- int[] values=(int[])Enum.GetValues(typeof(Gender));
- //foreach(int val in values ){
- // Console.WriteLine(val);
- // }
- string []nam=Enum.GetNames(typeof(Gender));
- foreach(string name in nam){
- Console.WriteLine(name);
- }
- }
- //Employee.EmoloyeeData();
- }
- public enum Gender{
- UnKnow=0,
- Male=1,
- Female=2
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement