To an abstract Class Deposit and declare:
-
To an abstract Class Deposit and declare:
♪ Government money only for reading Amount
♪ Public purpose only for the reading of Period (month deposit)
• Designer with deposit parameters Amount and depositPeriod, which creates the deposit of the object with the amount in question for that period.
♪ An abstract Income method that returns monetary value is the sum of the deposit income.Revenue is the difference between the amount removed from the deposit after expiry and amount contributed. Show me how to describe the method properly.
Income
class Deposit { public readonly decimal Amount;
//TODO: Define public readonly property "Period" with int type. public readonly int Period; //TODO: Define constructor that gets "Amount" and "Period" and assigns them to its properties. protected Deposit(decimal amount,int period) { Amount = amount; Period = period; } //TODO: Define public abstract method "Income" that returns deposit profit depending on "Amount" and "Period". public abstract Income(decimal amount, int period) { // }
}
-
abstract class Deposit { public readonly decimal Amount; //TODO: Define public readonly property "Period" with int type. public readonly int Period; //TODO: Define constructor that gets "Amount" and "Period" and assigns them to its properties. protected Deposit(decimal amount,int period) { Amount = amount; Period = period; } //TODO: Define public abstract method "Income" that returns deposit profit depending on "Amount" and "Period". public abstract decimal Income(decimal amount, int period); }
That's how to correctly apply the abstract method in the abstract class. Such methods are only inherited.
//наследование
class ChildClass : Deposit
{
public override decimal Income(decimal amount, int period)
{
//реализация после наследования
}
}
Read abstract classes and specify the terms of the task.