Skip to main content
留学咨询

辅导案例-EN3085

By May 15, 2020No Comments

EN3085 Assessed Coursework 2 You should solve the problems independently from other students and submit only your own work. Submit the programs and a short report explaining your solutions and demonstrating their correctness by 6pm, 08/05/20 through Learning Central. 1. Your company has won a contract to create a software system for a local library. The library stocks three types of items: books, films and music albums. The program should allow a librarian to add new items to the cataloguing system, to issue the items to the library members and to update the returned items. Your colleagues have provided you with the following class hierarchy diagram: a. Write a C++ class Entry according to the given diagram. Derive from it three subclasses: MusicAlbum, Book and Film. The class Entry should have member variables to store the name of the item and if it is borrowed and by who. The subclasses should have additional data members as specified in the diagram. Include member function declarations into your four class definitions according to the diagram. In addition, include two constructor declarations for each of the subclasses: one constructor with parameters for passing the values of all data members and another constructor with no parameters, but which allows the user to enter the values for all data members interactively. Use virtual functions appropriately. [3] b. Write definitions of all member functions for classes Entry and Film. The functions printDetails() should display the values of their class data members. [3] Book author : string publisher : string edition : string printDetails() MusicAlbum artist : string recordLabel : string printDetails() Film director : string language : string printDetails() Entry borrowed : bool borrowedBy : string name : string year : string Entry() entryBorrowed(string name) entryReturned() printDetails(); c. Expand your classes with useful extra data members and functionality. [3] d. Write a C++ program, which will use the above classes. Use as many of the C++ and C++ Standard Library features as you can. [3] e. Provide documentation for your program (limited to 4 pages including screen shots). Include a short description of the problem-solving phase and the implementation of your program, as well as an account of its limitations and possible improvements. In addition, as part of the documentation, provide evidence of testing. You must supply and explain the choice of values, which you used to test your program and the answers, which the program gave. You should also document any particular cases for which your program fails, or better add code to your program to make sure that they do not occur. [3] Marking scheme (1) Source code. Maximum marks will be awarded for: A correctly functioning program. The program should operate according to the specification. An efficient program and elegant algorithms. Try to develop algorithms, which are efficient in terms of the amount of data, which needs to be stored, and the speed in which they operate. Appropriate use of classes and functions. Try to keep your function main() as short as possible. A user-friendly program. When your program runs, the messages displayed on the screen should be easy to understand and succinct. The user should be in no doubt as to what they must do to use the program. A well commented program. The judicious use of commenting is essential if somebody else is to easily understand your program. Start your programs with a short comment specifying the name of the program, your name, and what your program is designed to do. A well laid out program. Indent your program code. Indent your comments as well. Use blank lines to space out blocks of code. (2) Documentation. Marks will be awarded for: • A well documented program. Include a short description of the problem-solving phase and the implementation of your program, as well as an account of its limitations and possible improvements. • A well tested program. You must supply and explain the choice of values, which you used to test your program and the answers, which the program gave. You should also document any particular cases for which your program fails, or better add code to your program to make sure that they do not occur. Dr Y Hicks 1.您的公司赢得了为本地图书馆创建软件系统的合同。图书馆存放三种类型的物品: 书籍,电影和音乐专辑。该程序应允许图书馆员将新项目添加到编目系统,将项目发 布给图书馆成员并更新返回的项目。您的同事为您提供了以下类层次结构图: a。根据给定的图编写一个 C ++类 Entry。从中派生三个子类:MusicAlbum,Book 和 Film。 Entry类应具有成员变量,以存储项目的名称,是否借用以及由谁借用。子 类应具有图中指定的其他数据成员。根据该图,将成员函数声明包括在您的四个类定 义中。此外,为每个子类包含两个构造函数声明:一个构造函数带有用于传递所有数 据成员的值的参数,另一个构造函数没有参数,但是允许用户交互地输入所有数据成 员的值。适当使用虚函数。 [3] b。编写 Entry和 Film类的所有成员函数的定义。函数 printDetails()应该显示其 类数据成员的值。 [3] C。使用有用的额外数据成员和功能扩展您的类。 [3] d。编写一个 C ++程序,它将使用上述类。尽可能使用许多 C ++和 C ++标准库功 能。 [3] e。提供程序的文档(包括屏幕截图,限制为 4页)。包括对问题解决阶段和程序实 施的简短说明,并说明其局限性和可能的改进。另外,作为文档的一部分,提供测试 证据。您必须提供并说明用于测试程序的值的选择以及程序给出的答案。您还应该记 录程序失败的任何特殊情况,或者最好将代码添加到程序中以确保它们不会发生。 [3] (1)源代码。最高得分将授予: 正常运行的程序。该程序应根据规范运行。高效的程序和优雅的算法。尝试开发算 法,这些算法在需要存储的数据量及其运行速度方面非常有效。适当使用类和函数。 尝试使函数main()尽可能短。一个用户友好的程序。当您的程序运行时,屏幕上显 示的消息应该易于理解和简洁。用户应该毫无疑问要使用该程序必须做什么。 一个好评的程序。如果有人要轻松地理解您的程序,那么明智地使用注释至关重要。 用简短的注释启动程序,并指定程序的名称,名称以及程序的用途。布置合理的程 序。缩进您的程序代码。缩进您的评论。使用空行来分隔代码块。 (2)文件。分数将授予: •记录良好的程序。包括对问题解决阶段和程序实施的简短说明,并说明其局限性和可 能的改进。 •经过良好测试的程序。您必须提供并说明用于测试程序的值的选择以及程序给出的答 案。您还应该记录程序失败的任何特殊情况,或者最好将代码添加到程序中以确保它 们不会发生。

admin

Author admin

More posts by admin