Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please please do 3.1 I am really confused let me know if you need anything else like the previous tasks Task 3: Contracts As we

Please please do 3.1 I am really confused let me know if you need anything else like the previous tasks

Task 3: Contracts

As we saw earlier, the starter code includes a Contract class in contract.py, which contains a basic set of attributes and methods. Each contract contains at the very least a start date and a Bill object.

We are making some simplifying assumptions:

regardless of the contract type, the billing cycle starts on the 1st of the month and ends on the last day of the month.

incoming calls are free.

for any given contract type, the rate charged for a minute is always the same. In other words, all contracts of the same type charge the same rate per minute, but different contract types may charge different rates.

The interaction between contracts and bills is something you have to piece together carefully, so we will give you some guidance to see the big picture, as follows:

whenever a new month is encountered in the historic data from the input dataset, we advance to a new month of contract all customers and all phone lines. You did this already in application.py, by calling the new_month() function from that module in the process_event_history(), whenever the timestamp of an event indicates a new month is encountered.

given that historic records get loaded gradually, the bill attribute of a contract always represents the latest bill (the one for the month we are currently loading events for). Once the data is fully processed, the bill is basically corresponds to the last month encountered in the input data.

notice that the contract instance has the information on how much a call should be charged, whether a call should be free or billed, etc. Therefore, you must ensure that each monthly bill can get this information, whenever you advance the month.

To understand the interaction between contracts and bills, ask yourself these questions:

is this the first month of the contract?

do you get new free minutes for the contract type?

how do you handle billing a call?

what is specific to each contract type?

Your task: implement classes for each of the three types of customer contracts: month-to-month, term, and prepaid. The new classes must be called MTMContract, TermContract, and PrepaidContract respectively.

To prepare for this task, you need to do two things:

First, review all the variables we have provided in module contract that store predefined rates and fees. You must not modify these.

Then, make sure you understand the Bill class, defined in module bill. Pay particular attention to methods set_rates() and add_fixed_cost(). They will be important when you need to create a new monthly bill.

Task 3.1: Implement term contracts

A term contract is a type of Contract with a specific start date and end date, and which requires a commitment until the end date. A term contract comes with an initial large term deposit added to the bill of the first month of the contract. If the customer cancels the contract early, the deposit is forfeited. If the contract is carried to term, the customer gets back the term deposit. That is, if the contract gets cancelled after the end date of the contract, then the term deposit is returned to the customer, minus that months cost.

The perks of the term contract consist of:

having a lower monthly cost than a month-to-month contract

lower calling rates, and

a number of free minutes included each month, which refresh when a new month starts. Free minutes are used up first, so the customer only gets billed for minutes of voice time once the freebies have been used up.

To prepare, have a look over the TERM_DEPOSIT fee defined in contract.py, as well as the corresponding rate per minute of voice time.

You can assume that the bill is paid on time each month by the customer, so you dont have to worry about carrying over the previous months bill for a Term Contract. It is important to note that a customer in a Term Contract can continue with the same contract past its end date (at the same rate and conditions), and can do so until the contract is explicitly cancelled. When the term is over (and the contract hasnt been cancelled), instead of adding a new term deposit and refunding the old one, the deposit simply gets carried over and does not get refunded until the contract gets cancelled.

Your task: Implement class TermContract as a subclass of Contract. The TermContract methods must follow the same interface as the Contract class. Consider each aspect of a term contract carefully!

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Advances In Databases And Information Systems 23rd European Conference Adbis 2019 Bled Slovenia September 8 11 2019 Proceedings Lncs 11695

Authors: Tatjana Welzer ,Johann Eder ,Vili Podgorelec ,Aida Kamisalic Latific

1st Edition

3030287297, 978-3030287290

More Books

Students also viewed these Databases questions

Question

=+2 How does the preparation and support for each type of IE vary?

Answered: 1 week ago