/******************************************************************************
Online C# Compiler.
Code, Compile, Run and Debug C# program online.
Write your code in this editor and press "Run" button to execute it.
*******************************************************************************/
//أكمل العمليات التالية للفئة المعطاة
using System;
class HelloWorld {
static void TestBus()
{
Bus Bus1 = new Bus();
Bus1.Id = 19;
Bus1.c = 50;
Bus1.Company = "Egged";
Bus1.Print();
bool b = Bus1.IsEmpty();
Console.WriteLine("IsEmpty: {0}", b);
Bus1.SetP(11);
b = Bus1.IsEmpty();
Console.WriteLine("IsEmpty: {0}", b);
Bus1.Print();
Bus Bus2 = new Bus();
Bus2.Id = 101;
Bus2.c = 15;
Bus2.Company = "Dan";
Bus2.Print();
Bus2.SetP(7);
Bus2.Print();
}
static void Main() {
Console.WriteLine("Hello Bus");
TestBus();
}
}
using System;
public class Bus
{
//صفات
public int Id;
public int c;
public int p;
public string Company;
//عمليات
public void SetP(int p)
{
this.p = p;
Console.WriteLine("SetP - P: {0}.", this.p);
}
public void Inc(int p) { }
public void Dec(int p) { }
public bool IsEmpty() {
if (this.p == 0)
return true;
else
return false;
}
public bool IsFull() {
return false;
}
public void Print()
{
Console.WriteLine("Id: {0}, C:{1}, P:{2}, Company:{3}",
this.Id,
this.c,
this.p,
this.Company
);
}
}