Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

I need this in C++ OOP (object oriented programming). This is supposed to be a 200+ lines of code. I need this in C++ OOP

I need this in C++ OOP (object oriented programming). This is supposed to be a 200+ lines of code.

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

I need this in C++ OOP (object oriented programming). This is supposed to be a 200+ lines of code.

Task Write a program for a mobile operator to manage the bills of different call plans. Object-Oriented Programming Assignment (200 Marks ) You will have a base abstract class Plan which has the following members: 1- Customer Name: a string holding the customer's name 2- Phone number: a string holding the mobile phone number. 3- Bill Month: an int with values ranging from 1 to 12 indicating the month of the bill. 4- A parameterized constructor. 5- A pure virtual function calculateBill( ) 6- A pure virtual function readCalls(istream\&,int\&,int\&) that given a file with the calls' duration of the customer, it sets the second \& third parameters as given in the derived classes. 7- A virtual function printAccountDetails() which prints the account's customer name, phone number \& month of the bill as one of the months {Jan,Feb,Mar,..Dec}. A sample of the file calls.txt is shown. Each line in the file has the call duration, as minutes and seconds, and the phone number of the receiver of the call. Note that the call duration will be rounded up to minutes when readCalls is executed, so for instance 03:02 becomes 4 minutes. Add two derived classes from the base Plan called PackagePlan and RatePlan. PackagePlan gives the customer a certain number of minutes monthly with a fixed cost (monthlyCost). The minutes available are divided into minutes to the same operator (sameMins), and minutes to other operators (otherMins). Assume that phone numbers of this operator start with 033. If the customer needs more minutes either to the same operator or other operators than the minutes given by the package, the extra minutes will have a certain rate (outRate). PackagePlan has 6 member variables which are: 1- sameMins (available minutes to the same operator be consumed monthly) 2- otherMins (available minutes to other operators to be consumed monthly) 3- monthlyCost (the fixed cost of the package) 4- outRate (the rate of a minute outside of the package) Combuters and Artificial Inte 5- remainingMins (initially set by all of the available minutes in constructor, then updated by readCalls()) 6- outPackMins (initially set to 0 in constructor, then updated by readCalls()) PackagePlan also has: 1- A parameterized constructor to take in the customer's name, customer's phone number, current month, available minutes for the same operator, available minutes for different operators, monthly cost, and out of package rate. 2- The overridden member function calculateBill, which will calculate \& display the details of the bill. 3- The overridden member function readCalls(istream\&, int\&, int\&) that given a file with the calls' duration of the customer, it sets the second parameter to the minutes to the same operator \& the third parameter to minutes to other operators. 4- The overridden function printAccountDetails() which prints all account's details represented in Plan and PackagePlan. 5- A member function remainingMinutes to return the remaining available minutes in the package. 6- A member function outOfPackageMins that returns extra minutes outside of the package. RatePlan gives a special rate (callRate) for the minutes without limits to the monthly number of minutes. It also gives the option of adding a favorite number for the customer where cost of calls to this number are calculated based on a discounted rate (favNumRate). RatePlan has 3 member variables which are: 1- callRate: a double storing the cost of the minute. 2- favNumRate: a double storing the cost of the call minute to the favorite number. 3- favNum: a string storing the favorite number of the customer. RatePlan has 4 member functions which are: 1- A parameterized constructor to take in the customer's name, customer's phone number, current month, call rate, favorite number rate, and favorite number. 2- The overridden function calculateBill, which will calculate \& display the details of the bill. 3- The overridden function readCalls, that given the calls file, it returns the second parameter as the duration of the calls to the favorite number, and the third parameter as the calls to numbers other than the favorite number. 4- The overridden function printAccountDetails() which prints all account's details represented in Plan and RatePlan. Finally, create a main that: 1 - creates an array of Plan* Plan* plans[5]. 2- displays a menu for the user that loops for 5 times asking whether the user wants to create a package plan or a rate plan. Enter () for package plan and (1) for rate plan: 2- If the user enters 0 , then create a package plan object and add it to the array, otherwise create a rate plan object. 3- For each of the plans chosen allow the user to enter all of the info required for that plan. 4- Finally, loop through the array and call printAccountDetails \& calculateBill for each of the objects created. For package plans call reminingMinutes and outOfPackageMins as well. Note: You may add member functions to any of the classes if you find it helpful , but do not add constructors. Only the mentioned constructors are allowed. Also you can use the built-in string functions for string manipulation. Object-Oriented Programming Assignment (200 Marks ) Example Scenario 1: Assuming the user entered 0 for package plan with the following info: Enter () for package plan and (1) for rate plan: o Enter Customer Name: Mona Ahmed Enter Phone Number: 03275869471 Enter Month (1-12): 3 Enter available minutes to the same operator: 100 Enter available minutes to other operators: 500 Enter monthly cost: 200 Enter rate of out of package minutes: 0.2 The output should be all of the info entered in addition to the detailed bill. Output: Name: Mona Ahmed Phone Number: 03275869471 Month: Mar Same operator minutes available: 100 Other operators minutes available: 500 Monthly cost: 200 Rate of out of package minutes: 0.2 Total minutes consumed: 422 minutes Same operator minutes: 108 Other operators minutes: 314 Monthly Bill: 201.6 Remaining minutes: 186 Out of package minutes: 8 Example Scenario 2: Assuming the user entered 1 for rate plan with the following info: Output: Name: Hassan Gamal Phone Number: 03293846255 Month: Dec Call rate: 0.15 Favorite number: 03189706483 Favorite rate: 0.05 Total minutes consumed: 422 minutes Favorite minutes: 114 Others minutes: 308 Monthly Bill: 51.9 Writing Good Quality Code No program stays the same. It will need to change to fix bugs, add new features, etc. So, it is very important to write high quality readable code, so that you or other developers can be able to review and modify this code in the future. In this task, you will: 1. Add a comment/header at the beginning of your program saying who the author is, the purpose of the program, etc. 2. Add a comment/header for every function explaining what it does, what parameters it takes and what value it returns. 3. Add comments to any part that is difficult to understand. Grading criteria (Total 200 marks) Good Quality Code (10 marks) Plan Class (30 marks) PackagePlan Class (60 marks) RatePlan Class(60 marks) main (40 marks)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions