首页 > > 详细

讲解StackOverflow 编程、C/C++ StackOverflow讲解

School of Information Technology and Mathematical Sciences
COMP 3023 Software Development with C++
Assignment
Asset Management System
Your task is to create an asset management system that stores details about assets that a company owns. The
company wants to track its high price electronic items; computers, phones, televisions and VR head mount
displays (HMDs).
The first step is to design a hierarchy of classes that can represent each of the asset types in code; you are
required to document your design with a UML class diagram (in png format). The hierarchy must have at least the
Computer, Phone, Television, HMD and Asset classes, where Computer, Phone Television and HMD derive from
Asset.
Each asset must have a maintenance record, each entry must have a timestamp (at least Date, but preferably a
date and time) and the name of the person who performed maintenance.
Each asset needs to be accounted for at tax time. The asset management system must calculate the depreciation,
for taxation purposes, for each individual asset. The prime cost calculation for depreciation is:
𝑑𝑒𝑝𝑟𝑒𝑐𝑖𝑎𝑡𝑖𝑜𝑛 = 𝑝𝑢𝑟𝑐ℎ𝑎𝑠𝑒𝑃𝑟𝑖𝑐𝑒 ∗ 𝑑𝑎𝑦𝑠𝐻𝑒𝑙𝑑365 ∗ 1𝑒𝑓𝑓𝑒𝑐𝑡𝑖𝑣𝑒𝐿𝑖𝑓𝑒𝑠𝑝𝑎𝑛
Where effectiveLifespan is the pre-determined effective life for the asset type in years. The below table identifies
the lifespans for the asset types.
Asset Type Effective Life (years)
Phones 2
Laptop computers 3
Desktop computers 4
Televisions 6
VR Head Mount Displays (HMDs) 2.5

The UML class diagram must display all public properties; member variables exposed by accessors and (optionally)
mutators. The diagram must display all public member functions. The diagram may optionally display private
member functions, but must not display private member variables. When creating the hierarchy, remember best
practice for object oriented programming and the DRY (Do not Repeat Yourself) principle.
You have been given a program that contains an asset storage class (AssetRegister), which stores and retrieves
assets by their unique asset identifier. The implementation of the Asset class hierarchy in code must use
inheritance and may optionally use polymorphism.
You will then need to write a text based menu program that accesses the asset register and allows users to view
and modify the details of assets. The menu must display the options as stated in this specification. You are given
the class MenuInterface which contains the interaction member functions; all menu related code must reside in
that class.

Software Development with C++ - Assignment SP5 2017 Page 2 of 6
Data
Create a Class Hierarchy to store the assets, there are four asset types; Computer, Phone, Television and HMD.
Every Asset must have at least the following attributes:
• ID
• Brand
• Model
• Purchase Price
• Purchase Date
• Disposal Date
Computers have at least the following attributes:
• Serial Number
• Operating System
• Network Identifier
• Custodian
Phones have at least the following attributes:
• Serial Number
• Operating System
• Phone Number
• Billing Identifier
• Custodian
Televisions have the following attributes:
• Serial Number
• Location
HMDs have the following attributes:
• Serial Number
• Custodian
Custodian must be a class type. Custodians have the following attributes:
• Name
• Department
• Phone Number
• Employment Start Date
Each asset must keep a maintenance record and each entry will need to have:
• Timestamp
• Maintenance Person (name)

Each asset type must implement a member function calculateDepreciation(const Date &date) that
calculates the depreciation value based on the previously given formula.
Software Development with C++ - Assignment SP5 2017 Page 3 of 6
The Menu Interface
The program must provide the user a menu, the menu options must be as follows:
What would you like to do?
(a)dd an asset
(d)ispose an asset
(u)pdate asset custodian or location
add asset (m)aintenance record
(l)ist assets by type
List assets by (c)ustodian
(f)ind asset
(q)uit

The user will enter the letter shown in brackets to select which action to take. Operations will request input from
the user (prompt), then the input must both be validated and echoed, giving the user the opportunity to cancel
an operation prior to modifying the asset in the asset register.
Some actions will have submenus as follows:
Add an asset submenu
Add an asset
add a (c)omputer
add a (p)hone
add a (t)elevision
(b)ack to main menu
List assets by type submenu
List assets by type
list (a)ll assets
list (c)omputers
list (p)hones
list (t)elevisions
(b)ack to main menu
Find asset submenu
Find asset
search by (a)sset id
search by (s)erial
(b)aⰠ⁴⁡⁵⁢  ‼⸍ 㱓⁴⽷㹡൲੥䌠䵥⁩㱴⁃⼫㸫ഠਭ䵁䱳⁳‰⁡†ㄠつ⁩㱳⁡⽹㹩൮੧䌠⁲†⁩⁵††㍩の†㱡⁡⽢㹬൥ਠ䍬⁲††‬ㄠ㕷⁩㱴⽰㹴൩੯‼‾⁡⹥†䝤ㅳ㔠⁡㱢⁴⼠㹴൨੥⁲⁡⁥⁳†⁥㔠⁡㱳⁴⼦㹲൳ੱ䵵†⁩⁦⁳†ㄯ〾‍㰊⁳⽥㹴ഠ੉䵄⁢⁲⁤⁥⁤㕥㰺⁰⽴㹩൰੬‹‰ ⡐䑵†⁣⤰‰㔮‰㰰⁢⽲㸠യਾ⁡‱⁹㔠′㰰†⼼㹢൲ਠ㰯 ⽄㹥൰ੲ䅥⁣⁤⁥㨵†⁩⡦⁴‱䐯‷⤠ ⁥⁡⁲⁎⁢‍⁥㱴⁲⽫㸠൉੤›⁋⁲‍⁡⹳⁴†‱⁩†‍Ɐ⁤⁩†⁲ 㱌⁴⼠㹍ൡ੩⡮⁥ⰱ‶⁹ⰾ‍Ⱟ‾⥣
⁡⁴‾⹮⁡⹣⸠⁨䑩⁴† 㱡†⽭㹥൮ੵⱢ⁲⁦⁥⁨†‬⁨⁳⹰㱡⁳⽣㹲൥੥㱥†⽴㹨ൡੴ⁢‍‾⁳⁢⁂⁄ ⁍ⰺ†⁴⁥′⸠  ⁣†⁥⸰‰㰮†⼼㹢൲ਠ⁵⁳䴠䱄⁡‰⁲′‼ Ⱪ⁳⁡⁡› ‷⸾‍⁲†⁥․⁴⁩⁳㱡†⼼㹢൲ਠⱳ⁴⁣†‰†⁢‍ ‍⁡Ⱐ⁨ⵯ⁲
⁴⁡†⸠ 㰾‼⽢㹲ഠਯ†㱣⁴⽯㹤൩੡⁴†⁲㭤⁩†  ⁡⁢ ☠㭰ⱴ›†⁡㱲′⼰㸱റਠ ⡄⹰⹲⁴⥲Ⱐ ‼
⁵⹴㰠⽤㹴ails
(b)ack to main menu

Display maintenance details:
Maintenance History for asset comp003
- 22/07/2016 by John
- 16/05/2017 by Fred

(r)eturn to asset details
(b)ack to main menu

Your implementation must offer the menu options shown above.

Software Development with C++ - Assignment SP5 2017 Page 5 of 6
Implementation Rules and Hints
Singleton design pattern – as we require that only a single instance of the AssetRegister class exist in our program
it has implemented the singleton design pattern. To use the class, a (non-const) reference to the only instance of
the class can be retrieved through the instance() static member function.
Smart Pointers – the AssetRegister class uses the smart pointer std::shared_ptr to store and
retrieve the assets. You must use the std::make_shared() template function to create the
assets to pass to AssetRegister::storeAsset. See the below code snippet which adds a computer asset to
the register:
AssetRegister &am = AssetRegister::instance();
am.storeAsset(std::make_shared("comp003", "Dell",
"Inspiron 13 5378", 1100, Date{10,Date::July,2017}, "51NC167",
"Windows 10 Enterprise"));

Casts – your code should not use casts, except for casting between a base class pointer and a derived class (using
dynamic_pointer_cast), if your implementation requires this. e.g. to cast an Asset pointer to
Computer pointer you’d use the following code snippet:
std::shared_ptr computer =
std::dynamic_pointer_cast(asset);
Where asset is a shared pointer.
Type defines – if you know what you are doing, you may define type aliases for the shared pointer types for use in
the MenuInterface (and related) classes.
Remember to perform. null pointer checks before attempting to use an object through a pointer.
Follow the style. guide set for the course – see learnonline.

Software Development with C++ - Assignment SP5 2017 Page 6 of 6
Marking
Your assignment will be marked both automatically and manually; automatically using unit testing, shell scripts
and static code analysis tools. Your code will be inspected for style. – remember consistency is the primary goal of
all style. guides, the easier it is to understand your co

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

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