Question: Long Programming question: Launch CLion ( for example, by double - clicking on the CLion icon on the desktop or selecting it via the Start
Long Programming question:
Launch CLion for example, by doubleclicking on the CLion icon on the desktop or selecting it via the Start icon
Create a new project File New Project
Set the name of the project to bitmidterm
Set the location of the project.
Choose C
On your desktop or in a location that is easy to access create a folder and name it firstnamelastnamem
Once you finish solving the question, move Main.cpp Device.cpp Device.h Laptop.cpp and Laptop.h files to this folder.
You have to use the words in the text that are underlined, italic and in blue exactly as given.
You are developing a system to manage information about devices in an electronics store. The store sells two types of devices: Laptops and Smartphones.
You have a superclass Device and two derivedclasses Laptop and Smartphone Smartphone class will not be implemented in the midterm
Create the superclass Device, to store the following information about a Device; brand string model string serialNumber int and price float
points All the attributes are private.
points Implement the default constructor that should initialize all four members. The strings should be initialized to NA and the integer and float to zeros.
points Implement the overloaded constructor that should take all these member data values to be set at the time a Device object is created. The order of parameters is brand, model, serialNumber and price.
point Create calculatePrice method, which sets the price to
The method should only be accessible by the super class and any derived classes of it
point Implement setPrice method that sets the price based on the calculated price refer to points d and d
The method doesn't take any input parameters, the price should be calculated using the calculatePrice method based on the values set in the overloaded constructor.
The only accepted price value is between and inclusive
If a lower or higher value is calculated, the price should be set to or respectively.
Set the access specifier for this method that it can be accessedused by any class in the application.
point Implement getters for all the attributes.
The getters should be accessible by any class in the application.
Use the derivedclass Laptop, to store the following information about a laptop; storage int and ramSize int
points All the attributes are public
points Implement the default constructor that should initialize all four members of the super class refer to point b Also, the derivedclass's attributes should be set to
point Implement the default overloaded constructor that should take brand model, serialNumber, storage, and ramSize to be set at the time Laptop object is created.
The price should be set to
point Implement the calculatePrice method that should calculate the price based on the following:
If the ramSize is more than GB return storageGB over GB
otherwise, return storage
point Implement printDetails method that outputs the laptop's details brand model, serialNumber, storage, and ramSize
The method should be accessible by any classes in the application.
Your output should be similar to the one shown in the example below.
In Client Class Main
Point Create an object of Laptop using the default constructor.
Point Create another object of Laptop, with the values shown in the screenshot below, using the overloaded constructor.
point Set the price of the second Laptop
point Output the Laptop's information using printDetails method.
Output from default constructor
Brand: NA
Model: NA
Serial Number:
RAM: GB
Storage: GB
Price: $
Output from overloaded constructor
Brand: Dell
Model: XPS
Serial Number:
RAM: GB
Storage: GB
Price: $
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
