Explore Westonci.ca, the top Q&A platform where your questions are answered by professionals and enthusiasts alike. Explore a wealth of knowledge from professionals across different disciplines on our comprehensive platform. Get detailed and accurate answers to your questions from a dedicated community of experts on our Q&A platform.

The following table describes the required fields for two classes and typical values stored in those fields.

You are required to create a base class Printer and its child class PrinterCumScanner. Each of these classes should have user defined constructor and overridden Display() method so that the following test driver can work properly.


Sagot :

Answer:

hope this helps,if it did pls mark my ans as brainliest

Explanation:

using System;

class Printer{ string companyName; int pagesOutput;

double price;

public Printer(string companyName,int pagesOutput,double price){

this.companyName=companyName; this.pagesOutput=pagesOutput; this.price=price;

}

public virtual void Display(){ Console.WriteLine("companyName: "+companyName+" pagesOutput: "+pagesOutput+" price: "+price);

}

}

class PrinterCumScanner:Printer{ int imageDpi;

public PrinterCumScanner(string companyName,int pagesOutput,double price,int imageDpi):base(companyName,pagesOutput,price){ this.imageDpi=imageDpi; }

public override void Display(){ base.Display(); Console.WriteLine("imageDpi: "+imageDpi);

}

}

public class Program { static void Main(string[] args) { const int NUM_PRINTERS=3;

Printer []stock=new Printer[NUM_PRINTERS];

stock[0]=new Printer("HP",40,89.50);

stock[1]=new PrinterCumScanner("HP",40,215.0,320); stock[2]=new PrinterCumScanner("Cannon",30,175.0,240);

foreach(Printer aPrinter in stock){ aPrinter.Display();

}

}

}