首页 > > 详细

辅导CMP-5015Y调试C/C++程序、C/C++编程辅导

School of Comput_ing Sciences
Module: CMP-5015Y Programming 2Assignment: Summat_ive Coursework 2 - Offline Movie Database
Set by: Dr Gavin Cawley ()Date set: 24th February 2020Value: 30%
Date due: 29th April 2020 3pmReturned by: 27th May 2020Submission: evision
Learning outcomes
The aim of this assignment is for the student to gain experience in the design and implemen-tat_ion of a relat_ively simple applicat_ion in the C++ programming language. On successful com-plet_ion of this exercise, the student will have reinforced a basic understanding of the conceptsof classes and objects and will be familiar with the basic syntax of C++ programming constructsused to implement classes (including operator overloading) and have experience with stream-based I/O. The student will also have opportunit_ies to explore more advanced elements of theC++ programming language, such as templates and lambdas.
Specificat_ion
Overview
You are required to implement and test a C++ program to load the details of a collect_ion offilms (or “movies”, both terms may be used interchangeably) from a file, films.txt (availablefrom BlackBoard), and provide answers to a small set of simple database queries. All quest_ionsregarding the specificat_ionsmust be asked via the appropriate discussion board on themodulevolume on BlackBoard.
Descript_ion
The file films.txt, available on BlackBoard, contains informat_ion describing a number ofmovies, including the t_itle, the year inwhich it was released, the cert_ificate, (e.g. “R” or “PG-13”,indicat_ive of the audience for which the film is considered suitable), the genres describing thefilm, its durat_ion (inminutes) and the average rat_ings supplied by users. The programmust loadthe informat_ion in this file into an appropriate collect_ion of objects, so that database queriescould be answered without re-reading the file. The programmust consist of at least the follow-ing three modules:
• Movie.h and Movie.cpp - A Movie object describes the informat_ion stored about a par-t_icular film, such that there will be a separate Movie object for each film held in thedatabase. The class should have a suitable collect_ion of constructors, accessor methodsetc. and the stream I/O and relat_ional operators should be implemented.
1
• MovieDatabase.h and MovieDatabase.cpp - A collect_ion of Movie objects, one foreach film described in the data file. The class should provide overloaded I/O operatorsfor reading the data from file and displaying the database on the terminal and for an-swering the database queries. Rather than writ_ing a program that only implements thecurrent specificat_ions, we shouldwrite maintainable programs that are easily extendedto answer a variety of database queries, without writ_ing a lot of extra code (i.e. methodsthat answer generic queries are bet_ter than methods that answer very specific queries).
• main.cpp - This module contains the main funct_ion and uses the services provided by
Movie and MovieDatabase to answer the required database queries. This should pro-vide an easily understood top-level view of what the program actually does, without go-ing into unnecessary detail of how it is done (which is abstracted away by the use ofclasses, as explained in the lectures on CMP-4008Y and CMP-5015Y).
The main funct_ion must perform the following tasks:
1. Read in the database from the file films.txt, using the relat_ive path “films.txt”,provided via BlackBoard (when using CLion, the program will expect to find the filein the cmake-build-debug directory). This is necessary to ensure that the programruns correctly using PASS.
2. Display the ent_ire collect_ion of movies, arranged in chronological order. Themoviesmust be displayed in the same format in which they appear in films.txt.
3. Display the third longest Film-Noir.
4. Display the eighth most recent UNRATED film.
5. Display the film with the longest t_itle.
Deciding the appropriate set of methods and funct_ions for each module is an importantelement of the assignment, and sufficient thought to these design issues should bemadebeforecommencing implementat_ion.
Hints
• Tackle the problem one module at a t_ime (I would start with Movie.h and Movie.cppand have it more or less finished and tested before moving on to MovieDatabase.hand MovieDatabase.cpp and then construct main.cpp from the components alreadyconstructed). Note this is an example of “top-down design, bot_tom-up implementat_ion”,as discussed in the lectures on CMP-4008Y.
• For each module, it is a good idea to work out which interface methods and funct_ionsthe module should implement in order to provide the services required by main.cppbefore start_ing to code. If implement_ing the module proves unduly difficult, that is of_tenbecause the design is incorrect.
• Classes should be used to provide abstract_ion and encapsulat_ion (i.e. data should bemade available on a “need to know” basis).
• Make sure you have a good idea of what you have to do before you start to write thecode, and separate the task of working out what you want the computer to do from thetask of how to tell the computer to do it.
2
• It is important to test each module of the program in isolat_ion. Don’t write all threemodules and expect them all to work together first t_ime. Bugs are of_ten more easilydetected and removed at module level, rather than systems level. Each module shouldhave a test-harness.
• Implementat_ion of MovieDatabase requires the use of a vector (or similar data struc-ture), however Movie can be implemented and tested using material already covered onthis module.
Relat_ionship to format_ive assessment
This assignment is essent_ially a re-implementat_ionof the off-linemovie database in Java course-work from CMP-4008Y and in C as a format_ive coursework on this module. This gives an oppor-tunity to explore the differences and similarit_ies between Java, C and C++ on the same task. Thiswill reveal some of the advantages and disadvantages of each language and the progression ofideas in the development of this family of programming languages.
Deliverables
Youmust submit a .zip file to BlackBoard using the submission point located in the Summative
Assessment sect_ion. The.zipmust contain the source files of your program (Movie.h, Movie.cpp,
MovieDatabase.h, MovieDatabase.cpp and main.cpp). The .zip file must also contain a
.pdf file consist_ing of the source code list_ings for program, in the order given above. Studentsare encouraged to use the template set up at Overleaf.com (see the accompanying guidancenote available on BlackBoard). If you chose to generate the .pdf file in some other way, makesure that there is a t_itle page on the front giving your registrat_ion number and BlackBoard ID,and that the code is format_ted so that it is legible when printed on A4 paper and that lines arelimited to no more than 80 columns.
Resources
• https://stackoverflow.com/ - An excellent site for finding informat_ion about specificissues relat_ing to various programming languages, including C++. It is important howevernot to become too reliant on sites such as StackOverflow, which are great for details,but don’t give the “big picture”, so it is difficult to get a good understanding of program-ming in this way. Note that if you re-use or modify code found on-line, then you mustprovide a comment giving the URL and a brief explanat_ion of what modificat_ions havebeen made. Re-using code found on-line without proper at_tribut_ion would const_ituteplagiarism.
• https://en.cppreference.com/w/ - a website providing reference material on C++and its libraries.
• http://www.cplusplus.com/reference/ - another website providing reference ma-terial on C++ and its libraries.
If you become stuck, please do feel free to discuss problems with the teaching assistantsduring scheduled laboratory hours, or contact me via email () for assis-tance outside lab hours. However, quest_ions relat_ing to the specificat_ionswill only be answeredif asked via the discussion forum on BlackBoard.
3
Plagiarism and Collusion
StackOverflow and other similar forums (such as the module discussion board) are valuableresources for learning and complet_ing format_ive work. However, for assessed work such as thisassignment, youmay not post quest_ions relat_ing to coursework solut_ions in such forums. Usingcode from other sources/writ_ten by others without acknowledgement is plagiarism, which isnot allowed (General Regulat_ion 18).
Marking Scheme
Marks will be awarded according to the proport_ion of the specificat_ions successfully imple-mented, programming style (indentat_ion, good choice of ident_ifiers, comment_ing etc.), andappropriate use of programming constructs. It is not sufficient that the programmerely gener-ates the correct output. Professional programmers are required to produce maintainable codethat is easy for others to understand, easy to debug when (rather than “if”) bug reports arereceived and easy to extend. Relat_ively few marks are therefore assigned to correct operat_ionin the marking scheme. The code needs to be modular, where each module has a well-definedinterface to the rest of the program. The funct_ion of the modules should bemade as generic aspossible, so that it not only solves the problem specified today, but can easily me modified orextended to cater for future developments in the specificat_ion without undue cost. The codeshould be reasonably efficient. Marks may also be awarded for correct use of more advancedprogramming constructs or techniques not covered in the lectures. Students are expected toinvest_igate the facilit_ies provided by the C++ standard libraries.
• Movie.h and Movie.cpp - demonstrat_ing basic grasp of implement_ing simple classes inC++ and stream-based I/O using operator overloading. Potent_ial for use of enumerat_ions.[40 marks]
• MovieDatabase.h and MovieDatabase.cpp - demonstrat_ing use of generic contain-ers/algorithms from the STL, potent_ial for use of lambda’s etc. [30 marks]
• main.cpp
– Quality of implementat_ion. [10 marks]
– Task #1 - Sort the movies in ascending order of release date and display on console.[5 marks]
– Task #2 - Display the third longest Film-Noir. [5 marks]
– Task #3 - Display the eighth most recent UNRATEDmovie. [5 marks]
– Task #4 - Display the movie with the longest t_itle. [5 marks]
Note that this assignment is intended to assess C++ programming skills; while most C pro-grams are also valid C++ programs, solut_ions using a C programming style will at_tract lowmarks(as they would not demonstrate skills not already covered by the format_ive course work).
4

联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!