Question
How do you write the C++ code for the statements below? Develop an object-oriented model and then write a C++ program as explained below. You
How do you write the C++ code for the statements below?
Develop an object-oriented model and then write a C++ program as explained below. You will be using classes and objects, and appropriate member functions, constructors, destructor, etc.to handle the tasks outlined below. With the help of the attached example, you can write to a file and read from the file using the techniques in the example at the end. Any file activities will incorporate Exception handling machinery to make sure in case of the file activities failure, the program terminates successfully with appropriate messages. The idea of the program is the same as in H6. Except you will be writing and reading one object of the class Laptop designed in H6. You have a choice of using one module or multiple module programs.
Develop a C++ program that declares a base class Computer and will contain the following data member in the private access region:
Manufacturer - PC manufacturer
Model - PC Model
Processor - Processor Type and Speed
Model Year - Year Manufactured
Weight - Shipping Weight
There is one class derived from the base class Computer.
The class Laptop adds the following data members in the private access regions region as shown below.
Screen Size - in inches
Hard Drive Size - in GB or TB
Color Options - case color
You will declare and define all member functions for the classes mentioned above.
Declare one object of the class Laptop. Initialize the object by prompting the user and reading appropriate data from the keyboard. Once the object is created and written to a file (you can use a file name by prompting the user and get the name.) In file discussion, I have an example of that. The file is then closed and you open the file for reading and displaying the Laptop object on the screen.
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