Question: IN C# 2. Create the abstract base class Invoice. The class has the private attributes (instance variables): customer ID (type string), previous read (type int)

IN C# 2. Create the abstract base class Invoice. The class hasIN C#

2. Create the abstract base class Invoice. The class has the private attributes (instance variables): customer ID (type string), previous read (type int) and current read (type int). The class should also have the followings: A constructor that receives the customer Idne previous read and current read to initialize the instance variables A public property (with both set and get accessors) called PreviousRead, which is used to initialize the previous read. A public property (with both set and get accessors) called CurrentRead, which is used to initialize the current read. A public and an abstract method called consumptioncost (returns double that will be used for computing the cost of consumption. The method will be implemented and overridden in the derived classes. Extend the code to create a concrete and derived class called water Invoice, which inherits the base class Invoice. The class should include the followings: An attribute meter size (type float). A WaterInvoice constructor that receives the customer ID, previous read, current read as well as the meter size. Implement (redefine and over-ride) the method consumptioncost so that it computes the water invoice as ((current read previous read) * 0.3 * meter size). After defining the tow classes in this hierarchy, write an application with a Main Method that creates an object from the classes WaterInvoice. Then your application code should call the consumptionCoat method and prints out its value

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!