Ask Question, Ask an Expert


Ask Programming Language Expert

Assignment Overview:

Develop a program that provides viewing, creating, and storing information about telephone customers.

You will need to author two classes – Customer and Pensioner. Pensioner must be a subclass of Customer. These classes must be in their own files with separate header files. Details are given below.

Create a third class called Manager. The manager file can hold the main function. The Manager class must holds member functions which read a text file, called telephone.dat, line by line, performing appropriate actions at each line, till the end of the file is reached. You must make no assumptions about the length of the file.

Each line of the file has the following format:
- Jimbo Jones 43215678 56
- Gladys Skinner 7628372 56 P P23435

The action for each line will depend on the first character (the directive).

- If the first character is “O” then there are two possibilities.

- The customer is an ordinary customer. In this case the fields are firstName, lastName, telephoneNo and numberOfCalls. A Customer object must be created and initialised with values from this line.

- The customer is a pensioner. In this case, we have a field P that purely signifies which we are dealing with a pensioner, followed by the pension number. A Pensioner object must be created with the four Customer fields and also the pension number.
In either case, the resulting object should be added to an array of ten Customer pointers called ‘store’.   This array should be a private data member of the Manager class.

- If the first character is “D” then the Customer or Pensioner object most recently added to the store must be removed. The way that the store must be handled is to create a second private data member called ‘top’ which is originally set to zero. Each time you add a Customer object you add it at the point signified by top. Top is then incremented. Therefore, the first Customer is put in position zero and top is incremented to 1. When we remove a Customer, we use top to determine which object to remove.

- If the first character is “P” then all of the elements in the array must be printed to a file (called CustomerOutput.dat). The output must be appended to the file – not overprepare what is already there. The deleted elements must, of course, not figure in this output. The output must hold all of the information for the Customer. Furthermore, a telephone charge should be find outd as the number of calls at 45c each. If the Customer is a pensioner then the pension number must be output and a discount of 10% provided. Both the discount and the new price must be displayed. Note: that the techniques for calculating the charge must be defined in Customer class and overridden in the Pensioner class. Polymorphism must be used rather than any attempt to explicitly determine what type of object is being dealt with.

- If the line holds only white space, it must be ignored and the program must proceed to the next line.

- If the directive contains any character other than those above an error message must be give and the program should continue.
The output to the file must be provided in both of two ways:

- A technique called print must be provided in both the Customer and Pensioner class

- The << operator should be overridden in both classes.
Error messages must be provided in the following situations:

- Incorrect directives in the input file

- Attempting to add a customer to a full store

- Attempting to delete a customer from an empty store

- Any other appropriate situations

In each of these cases, the error message must be given and the program must be allowed to continue. In your report, give your view on which is the best techniques in particular circumstances.

Programming Language, Programming

  • Category:- Programming Language
  • Reference No.:- M9968

Have any Question? 

Related Questions in Programming Language

You must do this assignment correctly as described

You must do this assignment correctly as described below.  If you do not follow the directions or break the rules you will receive a 0 score. Simulation of checking tic-tac-toe board for wins by counting X and O in rows, ...

The briefyour small development team of ideally three

The Brief Your small development team of (ideally) three people has been asked to implement and test the Human Resource Information System desktop application. Your software product will be a database- backed desktop app ...

Programming lab assignment set awhat to submitcomplete

Programming Lab Assignment (Set A) What to Submit Complete Problem Solving Steps 1 - 3 (check plan, data analysis, initial algorithm, and refinement algorithm) for the following programs. 1. (Name: lab1a-1.cpp) Write a p ...

Concurrent programming task ydetailsmany banking systems

CONCURRENT PROGRAMMING TASK YDETAILS Many banking systems allow multiple cardholders access a single account (e.g. a business account). The consequence of this is that is possible for more than one person to attempt to w ...

Object oriented system analysis and design1non-functional

Object Oriented System Analysis and Design 1. Non-Functional Requirements a) Analysis of NFRs Analyse the Case Study documents and determine the non-functional requirements (NFRs) or system quality attributes necessary t ...

Electrical engineering computer methods assignmentq1 write

Electrical Engineering Computer Methods Assignment Q1. Write a program that given the following array, reverses all array elements and then prints them. int x[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; Q2. Write a program to d ...

Write a program that calculates several possible tips to

Write a program that calculates several possible tips to give to a waiter at a restaurant. Ask the user to enter the total cost of the meal and then calculate a tip at 10%, 12.5%, 15%, 17.5%, and 20%. Write the original ...

Cp1404cp5632 2016 sp22252 assignment 1 - shopping list

CP1404/CP5632 2016 SP2/22/52 Assignment 1 - Shopping List 1.0 Task: You are to plan and then code a console-based program in Python 3, as described in the following information and sample output. This assignment will hel ...

1 implement dfs by using prolog2 implement bfs by using

1. Implement DFS by using PROLOG. 2. Implement BFS by using PROLOG. 3.  Solve the problem of Question 3 in Assignment 1 by using your PROLOG programs of DFS and BFS, respectively. Question 3 from Assignment 1 to Solve wi ...

Csis program homeworkwrite a program where the user will

CSIS program homework Write a program where the user will enter a number between 1 and 50 representing a state. The program should display the full name of that state. Assume the states are in alphabetical order, that is ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

A cola-dispensing machine is set to dispense 9 ounces of

A cola-dispensing machine is set to dispense 9 ounces of cola per cup, with a standard deviation of 1.0 ounce. The manuf

What is marketingbullwhat is marketing think back to your

What is Marketing? • "What is marketing"? Think back to your impressions before you started this class versus how you

Question -your client david smith runs a small it

QUESTION - Your client, David Smith runs a small IT consulting business specialising in computer software and techno

Inspection of a random sample of 22 aircraft showed that 15

Inspection of a random sample of 22 aircraft showed that 15 needed repairs to fix a wiring problem that might compromise

Effective hrmquestionhow can an effective hrm system help

Effective HRM Question How can an effective HRM system help facilitate the achievement of an organization's strate