Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

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
D
P

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

Php amp session managment assignment -this assignment looks

PHP & SESSION MANAGMENT ASSIGNMENT - This assignment looks at using PHP for creating cookies and session management. Class Exercise - Web Project: Member Registration/Login This exercise will cover adding data connectivi ...

Task arrays and structsoverviewin this task you will

Task: Arrays and Structs Overview In this task you will continue to work on the knight database to help Camelot keep track of all of their knights. We can now add a kingdom struct to help work with and manage all of the ...

Extend the adworks applicationi add dialogs to allow the

Extend the AdWorks application I. Add Dialogs to allow the user to Add, Edit, Read and Delete a Customer and refresh the view accordingly. 1. The user should be able to select a specific customer from the DataGrid and cl ...

Overviewthis tasks provides you an opportunity to get

Overview This tasks provides you an opportunity to get feedback on your Learning Summary Report. The Learning Summary Report outlines how the work you have completed demonstrates that you have met all of the unit's learn ...

Task silly name testeroverviewcontrol flow allows us to

Task: Silly Name Tester Overview Control flow allows us to alter the order in which our programs execute. Building on our knowledge of variables, we can now use control flow to create programs that perform more than just ...

Question 1 what is a computer program what is structured

Question: 1. What is a Computer program? What is structured programming? 2. What is modular programming? Why we use it? 3. Please evaluate Sin (x) by infinite series. Then write an algorithm to implement it with up to th ...

Assignment - horse race meetingthe assignment will assess

Assignment - Horse Race Meeting The Assignment will assess competencies for ICTPRG524 Develop high level object-oriented class specifications. Summary The assignment is to design the classes that are necessary for the ad ...

Task working with arraysoverviewin this task you will

Task: Working with Arrays Overview In this task you will create a simple program which will create and work with an array of strings. This array will then be populated with values, printed out to the console, and then, w ...

Background informationthis assignment tests your

Background Information This assignment tests your understanding of and ability to apply the programming concepts we have covered throughout the unit. The concepts covered in the second half of the unit build upon the fun ...

Task - hand execution of arraysoverviewin this task you

Task - Hand Execution of Arrays Overview In this task you will demonstrate how arrays work by hand executing a number of small code snippets. Instructions Watch the Hand Execution with Arrays video, this shows how to ste ...

  • 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

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As