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

Assignmentcollege maintains a file of credit hours

Assignment College maintains a file of credit hours completed for their students, named CREDITS.TXT. Each line of the file contains: • the student's ID number (an 8-character string, containing 2 letters followed by 6 di ...

Assignment introduction to computer sciencepart a this

Assignment: Introduction to Computer Science Part A: This question is to be submitted to the instructor in the form of a Word (or OpenOffice) document containing the Java code and appropriate screen capture(s) of the out ...

Assignment lispoverviewthe purpose of this assignment is

ASSIGNMENT: LISP Overview The purpose of this assignment is for you to gain some experience designing and implementing LISP programs. This assignment explores only a few of the many interesting LISP features. This assign ...

1 take into account the number of hours worked if the

1.) take into account the number of hours worked. If the hours is greater than 40, then calculate 1.5 times the rate times the hours over 40. Add the overtime pay to the regular pay, calculated by multiplying rate times ...

Spreadsheet exercise1 run the spreadsheet program in your

Spreadsheet Exercise 1. Run the spreadsheet program in your computer and type the following:   A B C D E F 1 PAYROLL 2 XYZ COMPANY Employee Name Department Degree Salary Need Increase? 3 Nasser Mechanical Master 15000   ...

Write a gui application that prints out hello in either

Write a GUI application that prints out "Hello!" in either: English, French, or Spanish. When the user selects another language, the greeting shown in the greeting area should change. Your GUI should look like the interf ...

Provide a recursive definition of some sequence of numbers

Provide a recursive definition of some sequence of numbers. Choose one different from that of any posted thus far. Write a recursive method that given n, computes the nth term of that sequence. Also provide an equivalent ...

Test 1you are permitted the use of pre-written notes

Test 1 You are permitted the use of pre-written notes, previous labs and the textbook. You are NOT permitted the help of the Lab TA or the Internet. Any cheating will result in a report Academic Integrity Violation and a ...

Figure is code to count the number of primes from 2 to n

Figure is code to count the number of primes from 2 to n, using the sieve method on a suitably large array a. That is, a[i] is TRUE at the end only if there is no prime p i or less that evenly divides i. We initialize al ...

Program assignment multi-threaded programming in java

Program Assignment: Multi-threaded Programming in Java Using Locks Objectives: To practice programming cooperating, synchronized multiple threads of execution. Description: In this programming assignment you will simulat ...

  • 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

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

Describe what you learned about the impact of economic

Describe what you learned about the impact of economic, social, and demographic trends affecting the US labor environmen