Question
Create a class that can be used for a Personal Computer. The class should have attributes for the: -Manufacturer (e.g. Dell, Gateway, etc.), -Form Factor
“Create a class that can be used for a Personal Computer. The class should have attributes for the:
-Manufacturer (e.g. Dell, Gateway, etc.),
-Form Factor (laptop/desktop),
-Serial Number
-Processor ( I3, I5, I7, AMD Ryzen 3, AMD Ryzen 5, etc.),
-RAM (4, 6, 8, 16, 32, or 64GB),
-Storage Type (UFS, SDD, HDD) and
-Storage Size (128GB, 256GB, 512GB, 1TB, 2TB).
The constructor must accept the manufacturer, form factor, serial number, processor, RAM, storage type/size.
Create accessor methods that allow these attributes to be retrieved individually.
Create mutator methods that allow the RAM and the storage drive (type and size) to be changed.
Incorporate exception handling to reject invalid values in the constructor and mutator methods.
Create a toString() method formulate a string containing the manufacturer, form factor, serial number, processor, RAM, and storage type/size.
Write a main program that creates a vector that can contain personal computers. The program should prompt the user for an indeterminate number of personal computers, create a personal computer object, and add the object.
The program should check for a pre-existing “computer inventory” file and, if there is one, populate the collection (vector) of the inventory with the contents of the file.
The program should then provide the user with a menu allowing them to
-add a new computer to the inventory,
-delete a computer from the inventory,
-list all the computers in the inventory
-exit.
When exiting the menu (before exiting the program), the code should open a file and record all of the existing inventory in the file. This file will be used (in item 1 above) to prepopulate the inventory with existing entries the next time the program is run.
Step by Step Solution
3.43 Rating (150 Votes )
There are 3 Steps involved in it
Step: 1
Program personalcomputerh include include using namespace std Create personal computer with attributes of manufactureform factorserial numberprocessorRAMstorage type and size Appropriate constructorac...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