C++代写:CS206 Email Handler

用C++代写一个Email的处理程序,本质上是字符串处理函数以及程序设计。

Practical Work

By using Microsoft Visual Studio 2015, develop an object-oriented console application that can handle emails. Your program is NOT expected to be able to send emails. It is for providing the environment to build a database of the emails, displaying and handling the database content. While you are responsible for the final design of the console application, your program is expected to realise a class cEmail representing an email that contains the following:

  • Member variables including the fields To_From (that contains a name followed by an email address put inside a pair of square brackets, and a character to indicate whether it is a sent-to-receiver or received-from-sender message), Subject, Cc (that contains a name followed by an email address put inside a pair of square brackets), Message, and Date (e.g. 8 November 2015 can be represented by the integer 151108). Notice that the first 4 member variables are for storing a string, while the member variable Date is of type int.
  • Member functions for reading and writing the member variables in cEmail.

Then, develop the class Em_Han to build up a database that keeps the emails ever sent or received. The database can be realised by an array of a finite size, which is assumed big enough and your program does not need to check this. Member functions that allow the user to build up and display the content of the database should be implemented. Then, within the class, you are required to write public member function(s) to realise one of the following five tasks (of handling the email messages). The task to do should be determined by the remainder obtained from dividing your team number by 5. For example, if your team number is SEVEN, 7%5 = 2, you should do Task 2) of this assignment.

Task

  1. The function performs the sorting of the received emails based on the name of the sender (within the To_From field) in ascending order, and display a sorted list of sender name, subject and date of sending.
    Hint: To do the sorting, notice that strcmp(“Peter”, “Mary”) will return 1, meaning that “Peter” is larger than “Mary”. Similarly, strcmp(“Mary”, “Peter”) will return -1, strcmp(“Mary”,”Mary”) will return 0. Notice that you can ignore the sent-to-receiver messages.

  2. The function performs the sorting of the sent emails based on the name of the receiver (within the To_From field) in ascending order, and display a sorted list of receiver name, subject and date of receiving. To do the sorting, read the hint in Task 0). Notice that you can ignore the received-from-sender messages.

  3. The function performs the sorting of the emails based on the date in ascending order, and display a sorted list of date, name, and subject together with a string indicating it is a sent or received message.

  4. The function performs the sorting of the emails based on the subject in ascending order, and display the sorted list of subject, name, and date together with a string indicating it is a sent or received message. To do the sorting, read the hint in Task 0).

  5. The function asks the user to input a name, and display a numbered list of subject and date of the email together with a string indicating it is a sent or received email under that name. The user can then enter a number and the corresponding email will be deleted from the database.
    Hint: You can add a member variable in the cEmail class that specifies whether it is a valid email. If an email is deleted from the database, that email becomes an invalid email. On displaying the content of the database, only valid emails will be shown.

    • It is required that the class and the implementation of its member functions should be built as a separate static library and linked into the console application.
    • Your program is expected to provide a text-mode user interface so that users can repeatedly handle and display the database of emails until the user chooses to end the application.
    • Should you want to get a credit, you should design the application such that when a user wants to start it, he needs to login the application with a username first, which will be checked with a file that stores username-password pairs. If the username is new, the application will ask for a password from the user and store it into that file. If the username can be found in that file, the application will start only when the password is correct. The application will end if the user fails to provide the correct password in three consecutive trials.
    • Should you want to get a distinction, you should add and implement the following member functions in the class that:
      • i) Save the current database into a file
      • ii) Build the database from the file obtained by i) above.

Report

Your report should include:
Abstract: Summarise the objectives and achievement of your assignment in less than 100 words.

  1. Introduction: Describe the objectives and requirements of the assignment in detail, and give a brief account of the methodology.
  2. Methodology: It contains
    • How your team divides the work among the team members (very important, to be used as the basis for assessment)
    • The schedule and stages of developing the project
    • The structure of the developed program, including
      • The specifications of the classes defined, and the public/private member functions/variables inside - explain as far as possible why your group makes such choices
      • The flow of program. (It is good to include a flow chart to help illustration.)
    • What problems your group encounters, and how your group solves the problems
    • Testing of your program, which shows
      • How you validate your program, i.e. confirm that the solution is correct.
  3. Results
    • Include the results of executing your program captured from the screen.
  4. Conclusion and further development
    • Summarize the experience gained in the assignment
    • Indicate how your program can be extended and improved if more time is allowed.

The report should be in PDF format. It is NOT required to include the complete source code in the report. Rather, you should zip the folder(s) containing all your project files into a zipped file, which also stores the report. (See the General Description below.)

General Description

  1. Each team should comprise up to TWO students (THREE students for HD class).

  2. Unless you get prior approval from your subject lecturer/tutor, you must observe the following:

    • Do NOT use any technique or C++ constructs not taught in the subject
    • Any library not mentioned in the subject must NOT be used (e.g. the mathematics library to compute x to the power of y.)
  3. Each team should upload the zipped file to the Blackboard (under Groups, select File Exchange after clicking your team number).

  4. The documentation for your assignment is important. The ability of writing good comments in the program will also be an important factor to the final assessment of your assignment.

  5. It is compulsory to use a word processing tool to write your report. The font size must not be bigger than 12 or smaller than 10. Use 1.5 lines spacing on both sides of a page. Including all figures and tables, if any, the length of the report should not be shorter than 7 pages.