PROG24310 Programming Languages Assignment

Assignment Help C/C++ Programming
Reference no: EM132407291

PROG24310 Programming Languages Assignment, Sheridan College, Canada

In this assignment you need to write a C++ program that simulates different pricing plans for a cellular telephone provider.

Suppose you work in the marketing department of the "CellularX" company. Your boss wants you to compare a proposed plan that offers customers a Regular plan and a Premium plan. The Premium plan is designed so that customers who make many calls save money by paying a higher monthly fee. Which plan is best for the company?

Main Requirements -

A. Create a class Call that contains the following information: phone number called and duration of the call (in seconds). In the real world you also want to include date/time of the call. However, this assignment is a simplified simulation.

B. Create an Abstract class Customer and derived classes RegularCustomer and PremiumCustomer.

The Abstract class Customer should contain data members common to all customers, such as customer's name, calls made (use list of calls - see class Call above), balance, etc.

In the appropriate class (Customer, RegularCustomer, and PremiumCustomer) you need to define and/or implement the following methods (with appropriate data types):

1. setName( name ) to set the name of the customer.

2. getName() to get the customer's name.

3. addCall( number, duration ) to add the phone call to the list of calls, where the arguments are: phone number called and duration of the call (in seconds) - see class Call above.

4. setBalance( balance ) to set the balance.

5. getBalance() to get the balance.

6. computeBalance() to compute the balance based on the list of calls.

The appropriate formula must be used.

Note: You need to figure out in what class and how you are going to define these methods. Both RegularCustomer and PremiumCustomer classes must be derived from Customer. Assume the initial balance is zero.

CellularX company has two types of customers: regular customers (class RegularCustomer) and premium customers (class PremiumCustomer).

The difference between them is how the balance is calculated.

Compute a Regular Customer's balance as: balance = monthlyfee + percall × num_calls where monthly fee is $5, and per call rate is $1.

Compute a Premium Customer's balance as: balance = monthlyfee + persec × num_secs where monthly fee is $40, and per minute rate is $0.02 (i.e. persec = $0.02/60).

C. In your program you need to create a simulation: randomly generate 1000 customers in each group. Randomly generate the number of calls each customers made (between 20 to 500) and randomly generate the list of calls for each customer in each group. Each group must have the same number of customers and the same number of calls.

You must create a simulation class Simulation that will do the simulations and print the following information (see demo run below):

- Number of customers (same for all groups).

- Number of calls (same for all groups).

For each group you need to print:

- Average duration of the call (per customer, in minutes, rounded up: 63sec = 2min).

- Average balance (per customer).

- Name of the customer with largest balance and the balance.

- Name of the customer with smallest balance and the balance.

For each randomly generated customer in each group you need to:

1. Randomly generate full customer name (4-8 chars for first name and last name). Incorrect full names such as "Xrty Ghtezuu" are acceptable. Note: the first letter in the first and last name must be in upper case.

2. For each randomly generated call you need to:

1. Randomly generate the number called (assume it's US/Canada 10 digit number).

2. Randomly generate duration of the call (from 20 seconds to 3 hours).

Your program must answer which plan is better for the company and print the average profit (see Demo Run in requirement D.).

D. The demo output of your program must look exactly as shown below (see attached file).

E. In the Simulation class you need to have two vectors: vector of Regular Customers and vector of Premium Customers.

- Every randomly generated customer must be added to the corresponding vector.

- Every customer has a list of randomly generated calls

- Every randomly generated call must be added to customer's list of calls.

In the Simulation class you must have at least the following methods:

1. generateName() to randomly generate the customer's name.

2. generatePhoneNumber() to randomly generate the number called.

3. generateCallDuration() to randomly generate the duration of the call.

4. generateCustomer(...) to randomly generate a customer and generate his list of random calls - see requirement C above.

Note: the same function must be used to generate "premium" and "regular" customers.

F. During simulation you need to calculate/set the balance for each customer and then at the end of the simulation in the vector of customers you need to find the ones with the largest/smallest balance.

For instance, in the Simulation class you can use an index of the customer with largest/smallest balance in each category of customers. Or you can sort the vector of Customers (see bonus I.) and instead directly access the first/last element of this vector.

G. The main() function in your C++ program must be as follows:

int main() {

Simulation *sim = new Simulation();

sim->printResult();

delete sim;

return 0;

}

H. In your C++ program you should:

Declare constructors (if appropriate) and destructors (if used) in classes.

Add any member functions / properties that you think are needed.

Use proper Object-Oriented concepts (inheritance, polymorphism, class abstraction, dynamic dispatch, etc).

Use proper C++ libraries. Do NOT use C libraries.

Avoid using hardcoded values (use #define when appropriate).

Use reasonably optimized code: minimize time & space complexity, place data on the heap, use proper methods for lists and vectors, avoid repetitive code, etc.

I. In the Simulation class please sort the vector of customers (in each group) by their balance (from smallest to highest). This would allow you to easily find the Customer with the largest and smallest balance (see requirement G).

Attachment:- Programming Languages Assignment File.rar

Reference no: EM132407291

Questions Cloud

Vw diesel emissions scandal and college admissions scandal : VW Diesel Emissions Scandal. BP Deepwater Horizon Explosion and Oil Spill. College Admissions Scandal. Enron / Arthur Anderson Financial Scandal
What would you do if you were on the civilian ferry : This question is based on the "Ferry Dilemma", from Christopher Nolan's, "The Dark Knight".
Suppose the airline industry consisted of only two? firms : Suppose the airline industry consisted of only two? firms: American and Texas Air Corp. Let the two firms have identical cost? functions, C(q)=40q
Modify workplace visual media communication : Competency: Investigate and modify workplace visual media communication to enhance efficiency in completing tasks. You work for a marketing organization.
PROG24310 Programming Languages Assignment : PROG24310 Programming Languages Assignment Help and Solution, Sheridan College, Canada. Write a C++ program that simulates different pricing plans
Difference between the old economy and the new economy : What is the difference between the Old Economy and the New Economy. (the most important features of each, not how they functioned in the business cycle.)
Explain one of the major disadvantages of the network : For this assignment, please write 400-600 words on the following questions? Explain one of the major disadvantages of this network at its initial stage.
What bundle of raspberries and apples would he buy : If the price of raspberries is $1 per unit and the price of apples is $1 per unit and Georey has $100 to spend, what bundle of raspberries and apples would
How can genetic testing be beneficial : Doctors and scientists now have the ability to sequence a person's DNA to look for abnormalities. One common example of genetic testing is screening.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  The user enter the total rainfall for each of 12 months

Write a program that lets the user enter the total rainfall for each of 12 months (starting with January) into an array of doubles. The program should calculate and display:the total rainfall for the year,the average monthly rainfall,and the months w..

  Advantages of compilers and interpreters

Discuss the advantages and disadvantages of compilers and interpreters

  Write a program using for loops t

Write a program using for loops to produce the following output. Please read carefully the entire specification!

  Write a c program that plays the game of guess the number

(Guess the Number) Write a C program that plays the game of "guess the number" as follows: Your program chooses the number to be guessed by selecting.

  Implement class bankacct for bank usq

Implement class BankAcct, for Bank of USQ, using bankacct.cpp and bankacct.h and Implement an application bankUSQ_app.cpp

  Write a program that synchronizes the threads

CS314 Operating Systems - Write a program that synchronizes the threads such that deadlock does not occur and no little rascal starves. The output should specify which rascal is eating.

  Design and implement a c++ program for find friends

MCS2514Pgm1- Design and implement a C++ program that will help find friends according to a defined method. In particular, your program will find and display the ten people in database who answered a set of survey questions closest to what the user..

  Program to report on the roots of a quadratic equation

Write a complete C++ program to report on the roots of a quadratic equation ax2 + bx + c = 0, a ≠ 0. compute the roots.

  Write an entire c++ program that reads a positive integer

Write an entire C++ program that reads a positive integer entered by an interactive user and then prints out all the positive divisors of that integer in a column and in decreasing order.

  What can you say about the lift force on the airfoil

What would be one major and obviously visible change to the velocity and pressure coefficient curves if you were to redo this problem with the airfoil at a non-zero angle of attack?

  Discount sale is a derived class of a class called sale

Suppose the class named Discount Sale is a derived class of a class called Sale, and suppose the class Sale has public methods named get Total and get Tax.

  Function that has three inputs which are integers

Write a C++ function that has three inputs which are integers. The function returns true if the first number raised to the power of the second number equals the third number.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd