Answered step by step
Verified Expert Solution
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 TabletAfter 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 identifierinteger 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 G networksupportedGNetworkThe selling price of a tablet is always 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: if it does not support G network, if it supports G networks.The pawnshop maintains a bank account, the balance of which changes after each purchasesaletransaction 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 soldScope of workImplement the classes described above to meet the tests provided in the base project in thetestBasicModelTestcpp 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 testsIn the main function maincpp 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 releaseDevicemethod 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 eg getterssetters 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 lookahead 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 PledgeCreate one PawnShop object with an initial balance of one tablet object with a pledge price of and one phone object with a pledge price of 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 SalesCreate one PawnShop facility with an initial account balance of 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 changeAttention! 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: Only programs whose code is being built will be checked Pack the prepared code as a ZIP archive; Name the archive according to the pattern SurnameNameColoquium Do not include compiled code and built applications in the archive; Archives prepared in a different way than required will not be checked.
The content of the taskYou are the owner of a pawn shop PawnShop that accepts electronics as collateral, specifically mobiledevices: Phones MobilePhone Tablets TabletAfter 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 identifierinteger 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 G networksupportedGNetworkThe selling price of a tablet is always 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: if it does not support G network, if it supports G networks.The pawnshop maintains a bank account, the balance of which changes after each purchasesaletransaction 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 soldScope of workImplement the classes described above to meet the tests provided in the base project in thetestBasicModelTestcpp 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 testsIn the main function maincpp 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 releaseDevicemethod 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 eg getterssetters 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 lookahead 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 PledgeCreate one PawnShop object with an initial balance of one tablet object with a pledge price of and one phone object with a pledge price of 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 SalesCreate one PawnShop facility with an initial account balance of 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 changeAttention! 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: Only programs whose code is being built will be checked Pack the prepared code as a ZIP archive; Name the archive according to the pattern SurnameNameColoquium Do not include compiled code and built applications in the archive; 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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started