ارجوا المساعدة من اخواني المشرفين ارجوا منكم المساعدة به وجزاكم الله خير
homework5#:lnheritance and Polymorphism
1.the goal in this problem is to write classes and amin program to simulate different pric-ing plans for an internet service provider. this exercise concentrates on using inheritance and polymorphic methods ( virtual functions ). Suppose you work in the marketing department of the Baltimore on-line (BOL) service provider. You want to determine which payment plan is better for different customers. The types of plans include the customer, hacker, and chat-room plans:
Table 1 : Different ISP plans

In the customer plan, customers get 4 hours of connection time a month for $10.00 and pay a fixed rate of $4.00 an hour for access time over 4 hours. The Hacker Plan is designed so that customers who Spend more time on-line save money by paying a higher monthly fee of $20.00 for the first ten hours, and $2.50 an hour after that. Chatroom plan members pay $50.00 for unlimited monthly access and also pay an additional charge of 10 cents
for each time they dial up.
Write class definitions for Customer and for the derived sub-classes Hacker, and chatRoom.
Customer should contain data members common to all customers, like the number of hours connected for a month, the customer's name, the amount of disk space the customer requires and so on. Also implement a method for computing a bill, computeBill () which uses the ap-propriate algorithm and data member to compute a monthly charge for each type of customer. In all classes be sure to also include any constructors and other methods that you think are needed. The derived classes should contain any data members and initializations specific to's payment plan and a specific implementation for the computeBill () method which overrides the default method from the Customer class. Demonstrate programmatically which plan is better for the following customers:
• John Dough, a customer spending 6 hours on-line per month who dials-up 35 times and does not host any web pages (uses zero megabytes of disk space).
• Jane doe, a customer who spends 18 hour on-line per month, who dials-up 75 times and hosts 30 megabytes of web pages. (Note: Customer is not is not a valid option be-cause of the 1 MB Disk space limit).
• Javiar Dinero, a customer who spends 48 hours on-line per month, who dials-up 90 times, and who hosts 10 megabytes of web pages. (Note: Customer is not a valid option because of the 1 MB Disk space limit).
وهذا كود البداية الذي يريد حل ساعدووو اختكم ^_*
{
Customer [] list = new Customer[9]; // array that can hold 9 customers
list[0] = new Customer("John Dough",6,35,0);
list[1] = new Hacker ("John Dough",6,35,0);
list[2] = new ChatRoomMember ("John Dough",6,35,0);
for(int i=0; i<list.length; i++)
{
if (list.isvalidplan())
{
System.out.print("Customer " + (linst.getnem()) + " would pay " +
list.computeBill() + " dollars with a " +
list.gatplanName() + " type of plan.\n");
}
}
}
public static void main (string [] args)
ارجوااا منكم المساعدة وجزاكم الله خيراً

