Connect with a community of experts and enthusiasts on IDNLearn.com. Our experts are available to provide accurate, comprehensive answers to help you make informed decisions about any topic or issue you encounter.

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();

}

}

}

Thank you for joining our conversation. Don't hesitate to return anytime to find answers to your questions. Let's continue sharing knowledge and experiences! Thank you for choosing IDNLearn.com. We’re committed to providing accurate answers, so visit us again soon.