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 double-clicking 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 bit_midterm24
Set the location of the project.
Choose "C++17"
On your desktop or in a location that is easy to access create a folder and name it firstname_lastname_m24
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 super-class Device and two derived-classes Laptop and Smartphone (Smartphone class will not be implemented in the midterm)
Create the super-class Device, to store the following information about a Device; brand (string), model (string), serialNumber (int) and price (float).
(0.25 points) All the attributes are private.
(0.5 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.
(0.75 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.
(0.5 point) Create calculatePrice() method, which sets the price to 4500.
The method should only be accessible by the super class and any derived classes of it.
(1.5 point) Implement setPrice() method that sets the price based on the calculated price (refer to points 1.d and 2.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 100 and 3000(inclusive).
If a lower or higher value is calculated, the price should be set to 100 or 3000 respectively.
Set the access specifier for this method that it can be accessed/used by any class in the application.
(1 point) Implement getters for all the attributes.
The getters should be accessible by any class in the application.
Use the derived-class Laptop, to store the following information about a laptop; storage (int) and ramSize (int).
(0.25 points) All the attributes are public
(0.5 points) Implement the default constructor that should initialize all four members of the super class (refer to point 1.b). Also, the derived-class's attributes should be set to 0.
(0.75 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 0
(1.25 point) Implement the calculatePrice() method that should calculate the price based on the following:
If the ramSize is more than 16 GB, return (0.35* storage)+(GB over 16 GB *1.5)
otherwise, return 0.55* storage
(1.25 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)
(0.25 Point) Create an object of Laptop using the default constructor.
(0.25 Point) Create another object of Laptop, with the values shown in the screenshot below, using the overloaded constructor.
(0.5 point) Set the price of the second Laptop
(0.5 point) Output the Laptop's information using printDetails() method.
Output from default constructor
Brand: NA
Model: NA
Serial Number: 0
RAM: 0 GB
Storage: 0 GB
Price: $0.0
Output from overloaded constructor
Brand: Dell
Model: XPS 15
Serial Number: 123456
RAM: 16 GB
Storage: 512 GB
Price: $281.6

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!