Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This assignment allows you to explore inheritance, virtual functions, and operator overloading to model a computer system with various components. You can further extend the

This assignment allows you to explore inheritance, virtual functions, and operator overloading to model a computer system with various components. You can further extend the hierarchy by adding more specific components or functionalities. The framework you develop can be applied to many products consisting of various components.
You will be starting up a computer manufacturer and need a system to see that process the orders entered on your website. Each a computer has components such as CPU, Memory, and Storage. A computer may have multiple components of the each type.
The system will read an order file which has a customer name and ofder number on one line, followed by the components of the computer, one per line. As you read the order file, build a set of Computer objects, and store them in a vector. Close the order file and create an invoice file. Print the invoices for all the of the systems and wherr complete display a summary report.
Note:
All objects are dynamically allocated and deleted when no longer used.
All attributes are private unless specified.
Create appropriate Constructors, Destructors, and Accessor methods as needed.
Class declarations and implementations must be in the appropriate .h and .cpp files.
STEP 1:
Define a base class called Component with the following attributes and methods:
a. Attributes: name (string), serialNum(string), price (double), cost(double)
b. Methods:
i. Virtual void infoString0: This function should be virtual and returns a string with the basic information about the computer component.
ii. Void displaylnfo(): This function displays the component's information (i.e. infoString)
Create three derived classes: CPU, Memory, and Storage, each inheriting from the Component class.
a. Add common methods and attributes as needed to the base class.
b. Add specific attributes and methods to derived class as needed.
c. Each derived class will have its own serial number sequence that should be static in the class.
i. Serial numbers contain a letter and five digits.
d. Override the infoString 0 method and others needed for each class
Cpu:
a. Attributes: clockSpeed (double) in GHz, cores (int).
b. Serial numbers start at "C50001".
Memory:
a. Attributes: size (int)- in GB, speed (int)- in MHz
b. Serial numbers start at "M60001".
Storage:
a. Attributes: deviceType(string) capacity (int)-in GB, xferSpeed(double)-in GB/Sec, lifetime (int)- in 1000's of hours between failure.
b. Serial numbers start at "S70001".
Create a class called System that aggregates instances of CPU, Memory, and Storage.
a. Store the components in a vector called "config".
b. Additional Attributes: serialNum(string), totalPrice (double), totalCost(double)
i. Serial numbers start a "A10001".
ii. The class will generate a new serial number for each system.
c. Methods: printInvoice 0 it has a file stream as a parameter and prints a formatted invoice
d. Override the displayInfo(
image text in transcribed

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

Transactions On Large Scale Data And Knowledge Centered Systems Xxiv Special Issue On Database And Expert Systems Applications Lncs 9510

Authors: Abdelkader Hameurlain ,Josef Kung ,Roland Wagner ,Hendrik Decker ,Lenka Lhotska ,Sebastian Link

1st Edition

366249213X, 978-3662492130

More Books

Students also viewed these Databases questions

Question

Establish identity. 3 sin 2 + 4 cos 2 = 3 + cos 2

Answered: 1 week ago

Question

Which expression evaluates to false if x is 0 and y is 1 0 ?

Answered: 1 week ago