please i just a hint in how to start doing this home work
Notes: There is no need to make use of arrays. In fact using arrays to store all customers' records is a bad design.
Interstate Motorway Pty Limited requires you to design a program that will produce customer statements for passing through E-way checkpoints of four toll stations (denoted by A, B, C and D respectively) distributed on the nationwide motorway. The charge of each pass is specified as follows
These statements will be calculated from the checkpoint log file of the format 3435344 A 2005/02/22/08:22:414749038 A 2005/02/25/14:16:355186936 C 2005/02/28/08:34:533873242 D 2005/03/02/02:40:594749038 A 2005/03/05/14:16:354092191 A 2005/03/08/23:49:083435344 C 2005/03/11/08:22:414092191 C 2005/03/14/23:42:084749038 D 2005/03/17/14:16:353435344 A 2005/03/20/08:22:41...where the first column contains customer ids, the second column contains the toll stations and the last column contains the timestamps. Hence the first record in the above, for instance, indicates that the vehicle with tag number (i.e. customer id) 3435344 passed through toll station A at time 08:22:41 on 22nd February 2005.
In order that each statement carries also the customer's name and address, the address file will be provided in the form of 3435344 @ L Brooks,12 Shaftsbury Road,Burwood NSW 21343873242 @ N McGoldrick,8 Colless Place,South Melbourne VIC 32054092191 @ T Peachey,32 Evan Street,Penrith NSW 27504749038 @ D Merritt,70 Albert Street,Werrington NSW 27474967987 @ R Bailey,102-47 Pardalote Avenue,Glenmore Park NSW 27455186936 @ S Galloway,8-121 Coreen Road,Scoresby VIC 3179...For the convenience of processing the log file for the statements, the address file and the log file will be first merged and then sorted line by line alphabetically to generate the toll data file, which will thus look like
3435344 @ L Brooks,12 Shaftsbury Road,Burwood NSW 21343435344 A 2005/02/22/08:22:413435344 A 2005/03/20/08:22:413435344 B 2005/03/23/18:22:413435344 B 2005/04/10/28:22:413435344 C 2005/03/11/08:22:413435344 C 2005/05/10/14:22:413435344 C 2005/05/19/06:22:433435344 D 2005/05/01/01:26:413873242 @ N McGoldrick,8 Colless Place,South Melbourne VIC 32053873242 B 2005/03/29/02:40:593873242 B 2005/05/16/02:40:593873242 C 2005/04/07/22:40:593873242 D 2005/03/02/02:40:59...For instance, if an address file address.txt is mergered with a log file logfile.txt into a combined file combined.txt, then sorting the combined file will generate the needed toll data file tolldata.txt. Hence in this assignment, we will always assume that the input data are in the form of toll data file and simply forget about the existence of the log file and the address file.
In this assignment, you are required to design an algorithm in pseudocode for the solution of the problem and get it implemented in C++. Your implemented C++ program toll.cpp will read data in the format of the toll data file, i.e.
- customer id as a word
- toll station or '@' as a character
- customer address or timestamp as the rest of the line
calculate the total toll charged for each customer, and produce an invoice statement for each customer who has a non-zero balance. A statement for each customer should include the following information
- Customer's id, name and address
- Column heading: Date, Time, Station, Amount
- All records charged to the customer
- Total amount the customer owned in the statement
We note that if your program toll.cpp is compiled into toll.exe and the toll data file is tolldata.txt, then using piping toll.exe < tolldata.txt > statements.txtshould generate precisely the list of toll statements satisfying the above requirements. This means if you are using prompts for interative data input, you need to make sure that the prompts are sent to standard error device using cerr (instead of cout). This way, the prompts will not be piped into the output file statement.txt.