C++ Input Program specification.

computer science


C++ Help!!!
Program specification

  1. When the same person is going to receive more than one email having the same subject, then the contents of the message need to be combined (separated by commas) into only one notification.Actually the combined messages are separated by a comma and a space, such as ", "In the example input, there are 3 notifications for "Meredith" with the subject "Invoice", and with different message. The notifications will be combined into one: Meredith Invoice PARK-1203, PARK-1205, TECH-3034 The order matters. If it is done in an order different to that in which the notifications appear, then the program may fail test cases.
  1. Duplicate notifications may happen and they need to be combined into one. See example of Callie Invoice DISC-7294
  1. First special case: Any notification Approve-reservation that is followed (either immediately or after one or more lines) by a corresponding Approve-reservation(Cancelled) will require that both notifications be eliminated. See example of Amelia Approve-reservation 7669. The "message" has to match, and the "person" has to match.
  1. Second special case: Any notification Approve-purchase-order that is followed (either immediately or after one or more lines) by a corresponding Purchase-order-cancellation will require that the first notification be eliminated. See example of Miranda Purchase-order-cancellation D-9076. The "message" has to match, but the "person" does not have to match (such as Owen in this example). Any intermediate notification Purchase-order-revise with a matching "message" also needs to be eliminated (regardless of whether "person" was a match).
  1. The input file will always have the substring .1.txt (as the last part of the filename), which is used to attempt to open the next file, file 2, if it exists. Then the program will open file 3, if it exists, and so on up to and including file 9 (if it exists).In the example listed, the input file name uh-gray.1.txt is file 1. File 2 would be: uh-gray.2.txt, which is not explicitly specified to your program. Instead, your program needs to determine whether file 2 exists, and if so, open it and process it. When your program does not find file k, then it does not have to keep looking for file k + 1
  1. Each input file is to be processed independently of the other input files (if any). That is, the notifications of each input file are combined for that input file independently of other input files (if any).
  1. Global list of all input files: Once every input file has had its notifications combined (independently of the other input files), a global list of notifications will be created by taking one notification at a time of each of the input files.Example:File 1 has notifications A B C DFile 2 has notifications G H KFile 3 has notifications M NFile 4 has notifications Q R T SThe global list would be: A G M Q B H N R C K T D S
  1. The final step is to combine the global list of notifications. For example, if file 1 has a notification Alex Invoice PEDS-765, and file 4 has a notification Alex Invoice PSYCH-3654, then such notifications need to be combined into only one notification: Alex Invoice PEDS-765, PSYCH-3654

The input is one or more plain-text files. In any input file, each line is terminated with an end-of-line character. Each line will have a fixed set of data, separated by the tab character (that is, t). Lines that start with the symbol # should be considered comments and therefore skipped. There may be empty lines in the input file; such lines should be skipped.

Each line that is not a comment (or empty line) will always have three items. The first is the person receiving the notification. The second item is the subject line of the email. The third is the 'body' of the email message.

For the purpose of the assignment, we will pretend that another part of a notification system will replace the name for the actual email, and there will be a nicely formatted email message created automatically from the other information of each line.

The main program should be called notify and the syntax in which it will be tested is as follows:

./notify "input=FILENAME"

The parameter input specifies the name of the input file.

Example of program calls:

./notify "input=uh-gray.1.txt"

The source code will be compiled as follows:

g++ -std=c++11 -o notify -I ./ *.cpp

Rules to combine notifications:

Rules to combine input files:

Your program will output to the console (such as via cout) with the results of combining notifications. Your program must follow the output format exactly to facilitate automated grading (and to avoid failing test cases due to things such as output of an empty line at the end).

Instruction Files
886.0 Bytes

Related Questions in computer science category

The ready solutions purchased from Library are already used solutions. Please do not submit them directly as it may lead to plagiarism. Once paid, the solution file download link will be sent to your provided email. Please either use them for learning purpose or re-write them in your own language. In case if you haven't get the email, do let us know via chat support.