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

Write a program that will predict the size of a population

Write a program that will predict the size of a population of organisms. The program should ask for the starting number of organisms, their average daily population increase ( as a percentage), and the number of days the ...

Algorithmfor each of the problems below state the purpose

Algorithm For each of the problems below state the purpose in your own words, specify input that is needed, expected output, and the step by step process that will obtain the output from the input (the algorithm). Rememb ...

Programming assignmentdescription your algorithm first

Programming Assignment Description: Your algorithm first takes an input size (N) from the user and generates a random sequence of N integers ranging from -99999 to 99999. If N is less than 50, your program must print the ...

The program will store the realty listings data as a

The program will store the realty listings data as a dynamically allocated LINKED LIST, instead of an array of records. The program will allow the realtors to both maintain and use the listings data. 1. Again, begin the ...

Write an abstract superclass encapsulating a vacation a

Write an abstract superclass encapsulating a vacation: A vacation has two attributes: a budget and a destination. It has an abstract method returning by how much the vacation is over or under budget. This class has two n ...

Assignment- object oriented programmingthis program will

Assignment- Object Oriented Programming This program will use 2 different data structures to perform the same tasks; a vector and a dynamically sized array Write a complete C++ program that will: Declare a vector of inte ...

Now consider the outer loop of given figure consisting of

Now consider the outer loop of given figure, consisting of blocks B2, B3, B4, and B5. Let g be the transfer function for the loop body, from the entry of the loop at B2 to its exit at B5. Let i measure the number of iter ...

Retail transaction programming projectproject requirements1

Retail Transaction Programming Project Project Requirements: 1. Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The Lin ...

Lab stackslab exerciseimplement the following classesclass

Lab: Stacks Lab Exercise: Implement the following classes: Class Course that includes three instance variables: private int ID; // course ID private String Name; // course name private Course next; // link next Your clas ...

A theater-seating chart is implemented as a two-dimensional

A theater-seating chart is implemented as a two-dimensional array of ticket prices, like this: ROW 6: 10 10 10 10 10 10 10 10 10 10 ROW 5: 10 10 10 20 20 20 20 10 10 10 ROW 4: 20 20 20 20 20 20 20 20 20 20 ROW 3: 20 20 3 ...

  • 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

WalMart Identification of theory and critical discussion

Drawing on the prescribed text and/or relevant academic literature, produce a paper which discusses the nature of group

Section onea in an atwood machine suppose two objects of

SECTION ONE (a) In an Atwood Machine, suppose two objects of unequal mass are hung vertically over a frictionless

Part 1you work in hr for a company that operates a factory

Part 1: You work in HR for a company that operates a factory manufacturing fiberglass. There are several hundred empl

Details on advanced accounting paperthis paper is intended

DETAILS ON ADVANCED ACCOUNTING PAPER This paper is intended for students to apply the theoretical knowledge around ac

Create a provider database and related reports and queries

Create a provider database and related reports and queries to capture contact information for potential PC component pro