Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You are the owner of a pawn shop ( PawnShop ) that accepts electronics as collateral, specifically mobile devices: Phones ( MobilePhone ) Tablets (

You are the owner of a pawn shop (PawnShop) that accepts electronics as collateral, specifically mobile
devices:
Phones (MobilePhone)
Tablets (Tablet)
After pawning the device, it cannot be sold by a pawn shop for some time because the owner may
want to take it back. After this time, the device is released for sale. Each mobile device (phone or
tablet) has two prices: the priceOfPledge pledge price (set arbitrarily) and the selling price (calculated
dynamically) and are derived from the ElectronicDevice class. The mobile device also has an identifier
(integer IMEI field), manufacturer (manufacturer), a logical field allowedForSale informing whether the
device can already be sold (whether the time for purchasing the device by the owner who pledged the
device has already passed, if not it cannot be sold) and a logical field sold informing whether the device
has already been sold by a pawn shop. Additionally, the Tablet class stores information whether it can
make phone calls (allowedPhoneCall), and the MobilePhone class whether it supports the 5G network
(supported5GNetwork).
The selling price of a tablet is always 30% higher than its purchase price. In the case of a telephone,
the selling price is higher than the pawn shop's purchase price (pledged) by:
30% if it does not support 5G network,
40% if it supports 5G networks.
The pawnshop maintains a bank account, the balance of which changes after each purchase/sale
transaction, and stores information about devices both in stock and already sold (electronicDevices
field). The pawn shop may accept the devices as collateral or sell them. You can view the available
assortment (devices available for sale) and view the list of devices that have already been sold (please
note that some devices may be in stock at the pawnshop but not released for sale, so they are neither
available nor sold).
Scope of work
Implement the classes described above to meet the tests provided in the base project (in the
test/BasicModelTest.cpp file), as well as the requirements in the additional description below.
Implement additional tests as described below (the code you create should also meet these tests).
In the main() function (main.cpp), write the code that:
Creates a PawnShop object with the selected (positive) account balance.
Adds two devices to it - one of each type, then releases it for sale and sells one of them.
It prints the result of the showAvailableDevices() and showSoldDevices() methods to the
console.
Additional description model
We assume that device IDs are unique.
We assume that only the pawn shop changes the availability status of devices (releaseDevice()
method).
When creating a device (constructor), its allowedForSale availability should be set to true (only
the pawn shop sets this value to false after pawning the device), and the sold sales status
should be set to false.
Only available devices can be sold by a pawn shop.
It is possible for a pawn shop to accept only devices whose pledge price is not higher than the
current balance of the pawn shop's account. If a given device (with the same identifier) has
already been sold by a pawn shop and is purchased by it again, only the availability of this
device changes (it is not added to the list of devices again) and the balance of the pawn shop's
account.
We assume there are no exceptional situations and do not check them. We do not expect to
use the exception mechanism.
Remember that the program should be consistent with the UML diagram presented below (in
particular, pay attention to the correct operation of the getDeviceInfo() function in each class
and to the fact that ElectronicDevice is an abstract class).
Not all necessary methods are described in the text and diagrams (e.g. getters/setters)- they
need to be created if necessary.
The pledgeDevice method allows you to pawn the device and sets allowedForSale to false,
which prevents its sale.
Selling the device is only possible after setting the allowedForSale variable to true (call in
releaseDevice()). In the business logic of such a system, the change of the flag would depend
on the period that elapsed between the pledge and the attempted sale. For the purposes of
the colloquium, we assume that the user will change the device status on his own.
The sellDevice method allows a pawn shop to sell a device at the sales price calculated for the
device.
Additional description implementation
Remember to use look-ahead declarations instead of #include directives wherever possible.
Use initialization lists in constructors wherever possible.
Object collections are initially intended to be empty.
Remember to properly manage dynamically allocated memory.
When verifying the build of the project, make sure that not only the program code is built, but
also the test code.
Test scenarios
Remember that incorrect test building, lack of test implementation, and the project's failure to meet
the tests are different situations wit

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2010 Barcelona Spain September 2010 Proceedings Part 2 Lnai 6322

Authors: Jose L. Balcazar ,Francesco Bonchi ,Aristides Gionis ,Michele Sebag

2010th Edition

364215882X, 978-3642158827

More Books

Students also viewed these Databases questions

Question

In linear regression, compare independent and dependent variables.

Answered: 1 week ago

Question

An attribute in a relation can have multiple values

Answered: 1 week ago