How to implement programmatically the class hierarchy?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
8 views
Good day!
There is a task you want to perform:
To develop and implement a software class hierarchy for working with the account Bank. To do this, perform the following tasks:
1. To develop and implement software and base class Bill.
2. To develop and implement software and base class Depositor.
3. To develop and implement a programmatically derived class BillDepositor.
4. In the main part of the program to showcase the work of established class hierarchy.

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; class Bill { string _ID; double _Balance, Persent; protected string ID { get { return _ID; } set { value = _ID; } } protected double Balance { get { return _Balance; } set { value = _Balance; } } public Bill(string ID, double Balance) { this.ID = ID; this.Balance = Balance; Persent = 0.03; } public override string ToString() { return "Bill number:" + ID + "Balance:" + Balance; } ~Bill() { } } class Depositor { string _FullName, _Passport; protected string FullName { get { return _FullName; } set { value = _FullName; } } protected string Passport { get { return _Passport; } set { value = _Passport; } } public Depositor(string FullName, string Passport) { this.FullName = FullName; this.Passport = Passport; } public override string ToString() { return "Full Name:" + FullName + "Passport seria/number:" + Passport; } ~Depositor() { } } class BillDepositor : Depositor { double _MaxBill; string _Password; protected double MaxBill { get { return _MaxBill; } set { value = _MaxBill; } } protected string Password { get { return _Password; } set { value = _Password; } } public BillDepositor(string Password, double MaxBille, string FullName, string Passport) : base(FullName, Passport) { this.MaxBill = MaxBill; this.Password = Password; } } class Program { static void Main() { } }


In C#, you can do that would BillDepositor inherit from Bill and Depositor.
I tried:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; class Bill { string _ID; double _Balance, Persent; protected string ID { get { return _ID; } set { value = _ID; } } protected double Balance { get { return _Balance; } set { value = _Balance; } } public Bill(string ID, double Balance) { this.ID = ID; this.Balance = Balance; Persent = 0.03; } public void DisplayBill() { Console.Write("Account number:" + ID); Console.Write("Total bill:" + Balance); } public override string ToString() { return "Bill number:" + ID + "Balance:" + Balance; } ~Bill() { } } class Depositor : Bill { string _FullName, _Passport; protected string FullName { get { return _FullName; } set { value = _FullName; } } protected string Passport { get { return _Passport; } set { value = _Passport; } } public Depositor(string FullName, string Passport, string ID, double Balance) : base(ID, Balance) { this.FullName = FullName; this.Passport = Passport; } public override string ToString() { return "Full Name:" + FullName + "Passport seria/number:" + Passport; } ~Depositor() { } } class BillDepositor : Depositor { double _MaxBill; string _Password; protected double MaxBill { get { return _MaxBill; } set { value = _MaxBill; } } protected string Password { get { return _Password; } set { value = _Password; } } public BillDepositor(double MaxBill, string Password, string FullName, string Passport, string ID, double Balance) : base(string FullName, string Passport, string ID, double Balance) { this.MaxBill = MaxBill; this.Password = Password; } } class Program { static void Main() { } }

But, the error is displayed "does not contain a constructor that takes 8 arguments"
by | 8 views

1 Answer

0 like 0 dislike
//use public BillDepositor(double MaxBill, string Password, string FullName, string Passport, string ID, double Balance) : base(FullName, Passport, ID, Balance) //instead public BillDepositor(double MaxBill, string Password, string FullName, string Passport, string ID, double Balance) : base(string FullName, string Passport, string ID, double Balance) {


you have to call base constructor left the types of data which should not be
by
110,608 questions
257,186 answers
0 comments
35,390 users