Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The content of the taskYou are the owner of a pawn shop ( PawnShop ) that accepts electronics as collateral, specifically mobiledevices: Phones ( MobilePhone

The content of the taskYou are the owner of a pawn shop (PawnShop) that accepts electronics as collateral, specifically mobiledevices: Phones (MobilePhone) Tablets (Tablet)After pawning the device, it cannot be sold by a pawn shop for some time because the owner maywant to take it back. After this time, the device is released for sale. Each mobile device (phone ortablet) has two prices: the priceOfPledge pledge price (set arbitrarily) and the selling price (calculateddynamically) 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 thedevice can already be sold (whether the time for purchasing the device by the owner who pledged thedevice has already passed, if not it cannot be sold) and a logical field sold informing whether the devicehas already been sold by a pawn shop. Additionally, the Tablet class stores information whether it canmake 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/saletransaction, and stores information about devices both in stock and already sold (electronicDevicesfield). The pawn shop may accept the devices as collateral or sell them. You can view the availableassortment (devices available for sale) and view the list of devices that have already been sold (pleasenote that some devices may be in stock at the pawnshop but not released for sale, so they are neitheravailable nor sold).Scope of workImplement the classes described above to meet the tests provided in the base project (in thetest/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 theconsole.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 (onlythe pawn shop sets this value to false after pawning the device), and the sold sales statusshould 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 thecurrent balance of the pawn shop's account. If a given device (with the same identifier) hasalready been sold by a pawn shop and is purchased by it again, only the availability of thisdevice changes (it is not added to the list of devices again) and the balance of the pawn shop'saccount. We assume there are no exceptional situations and do not check them. We do not expect touse the exception mechanism. Remember that the program should be consistent with the UML diagram presented below (inparticular, pay attention to the correct operation of the getDeviceInfo() function in each classand to the fact that ElectronicDevice is an abstract class). Not all necessary methods are described in the text and diagrams (e.g. getters/setters)- theyneed 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 inreleaseDevice()). In the business logic of such a system, the change of the flag would dependon the period that elapsed between the pledge and the attempted sale. For the purposes ofthe 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 thedevice.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, butalso the test code.Test scenariosRemember that incorrect test building, lack of test implementation, and the project's failure to meetthe tests are different situations with different consequences for the test assessment.Test 1- PledgeCreate one PawnShop object (with an initial balance of 2000), one tablet object (with a pledge price of1000), and one phone object (with a pledge price of 3000). Pawn the tablet to a pawn shop. Checkwhether the current account balance is consistent with the expected one. Then try pawning yourphone at a pawn shop. Check whether the current account balance has changed, since the price ofpawning the phone is higher than the pawnshop's current account balance.Test 2- SalesCreate one PawnShop facility (with an initial account balance of 5,000) and mobile devices similarly tothe previous test. Pawn both devices to the pawn shop (with an increased initial account balance, thisshould be possible). Sell the tablet without releasing it for sale and check the pawn shop accountbalance (it should not change). Release the tablet for sale, sell it and check your pawn shop accountbalance again (it should change).Attention! The diagram is simplified because it does not present the required constructors, destructorsand access methods. The parameter types do not show whether it is a pointer, reference, or smartpointer.Requirements:1. Only programs whose code is being built will be checked.2. Pack the prepared code as a ZIP archive;3. Name the archive according to the pattern Surname_Name_Coloquium4. Do not include compiled code and built applications in the archive;5. Archives prepared in a different way than required will not be checked.

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

PostgreSQL Up And Running A Practical Guide To The Advanced Open Source Database

Authors: Regina Obe, Leo Hsu

3rd Edition

1491963417, 978-1491963418

More Books

Students also viewed these Databases questions