class Customer
int noOfCalls;
String custName;
virtual Compute_Bill();
//define function, contructors etc by Customer::Customer() etc

class Premium_Customer: public Customer
//premium specific function that inhereit from customer


I need help with this question, I have no idea how to write an object oriented program.
This is the Question:
Write class definitions for Customer and for a derived class Premium_Customer. Customer should contain data members common to all customers, like the number of calls made in a month, the customer's name, and so on. Also implement a virtual member function for computing a bill, Compute_Bill( ) which uses the appropriate algorithm and data members to compute a monthly charge for each type of customer. In all classes be sure to also include any constructors and other member functions that you think are needed especially if you use dynamic memory alĀ¬ location in your class. The derived class should contain data members and initializations specific to it's payment plan, and a specific implementation for the Compute_Bill() member function which overrides the default method. Demonstrate programmatically which plan is better for a customer who makes 30 calls per month averaging 3 minutes per call. What about 60 calls?

You haven't done enough yourself yet for us to provide constructive help without just doing the work for you. (We don't do that here, we help you fill in the gaps where you lack knowledge, but you have to narrow the gaps.)

The assignment recommended constructors and destructors, declare them and write them. Write the Compute_Bill() method.

Add constructors, destructors and Compute_Bill() to the derived class.

Write some form of main that will create at least one of each, calling their Compute_Bill() and output the bill (or the cost or whatever Compute_Bill() does).

Get the above code to compile and run. Then build on what you have to do the rest of what the assignment asks for.

If you start working and find a compile error that you don't understand, or if you're running the program and don't understand the results (or there aren't any) those make great questions to ask here. Things like "I'm trying to do ___ but when I compile it I get the error ___" or "I expected to see ___ but I'm seeing ___" make questions that are easy to answer for most of the experienced people here.

If you ask properly focused questions, you'll find the answers here are both quick and useful. If you ask broad, open-ended questions you tend to get few if any answers.

PS- when you do post code, please use the appropriate language specific code tags:
[code=c++] // your code goes here


This article has been dead for over six months. Start a new discussion instead.