Исправить код - C# (179272)
Формулировка задачи:
class Tel
{
protected string marka;
protected int funk;
string _marka
{
get { return marka; }
set { marka = value; }
}
public int _funk
{
get { return funk; }
set { funk = value; }
}
virtual public double Fondcost()
{
return 40 * Math.Log(funk);
}
public Tel()
{
marka = "";
funk = 0;
}
public Tel(string _marka, int _funk)
{
marka = _marka;
funk = _funk;
}
public void Print()
{
Console.WriteLine("marka: " + _marka);
Console.WriteLine("funk " + funk);
Console.WriteLine("wdadw {0} " ,Fondcost());
}
}
class Sotov : Tel
{
string model;
int god;
public Sotov()
{
model = "";
god = 0;
}
public Sotov(string model, int god, int _funk,string _marka) : base(_funk,_marka)
{
this.model= model;
this.god = god;
}
override public double Fondcost()
{
if (2017 - god <= 1)
return base.Fondcost() / 0.20 + base.Fondcost();
if ( 2017-god >= 3)
return (base.Fondcost() / 0.60) - base.Fondcost();
else return base.Fondcost();
}
public void Show()
{
Console.WriteLine("model: " + model);
Console.WriteLine("god " + god);
base.Print();
}
}
class Stas : Tel
{
string Y;
string N;
public Stas()
{
Y = "";
N = "";
}
public Stas(string _nesta, string _sta, int funk)
{
Y = _nesta;
N = _sta;
}
}
class Prog
{
static void Main(string[] args)
{
Console.WriteLine("Введите Марку и кол функций:");
Tel a = new Tel((Console.ReadLine()), Convert.ToInt32(Console.ReadLine()));
a.Print();
a.Fondcost();
Console.WriteLine("Введите Модель сотовый телефон и год и кол функций:");
Sotov w = new Sotov(Console.ReadLine(), Convert.ToInt32(Console.ReadLine()), Convert.ToInt32(Console.ReadLine()));
w.Show();
w.Fondcost();
Console.ReadKey();
}
}
}Решение задачи: «Исправить код»
textual
Листинг программы
class Telephone