Question: In DeskTop.h class is an empty class. return the value stored by this variable. The class also has two constructors: a default constructor that sets
In DeskTop.h
class is an empty class.
return the value stored by this variable. The class also has two constructors: a default constructor that sets missingComponent as
"essential components"; an overloaded constructor that take a parameter of string as input and set the value of missingComponent
In DeskTop.cpp
Provide the implementation of the member functions of the LackComponentException clas
Complete the turnOn function of the DeskTop class. This function will first check whether any of the three boolean variables, RAS
hardDrive, videoCard is false. If one or more of these variable values are false, a LackComponentException exception initialize
with a string encoding the missing component information will be thrown. For example, if only RAM is false, the string is "RAM", and if only hardDrive is false, the string is "hard drive". If both RAM and hardDrive are false, the string will be "RAM, hard drive", and if all three
variables are false, the string will be "RAM, hard drive, video card". If all the above variables are true, the function will check whether
e power is provided. If there is no power ie powerfalse a NoPowerException is thrown.
In main.cpp
Complete the maino function to handle the potential exceptions thrown when turning on a desktop computer. Specifically, after a DeskTop
computer is created based on user input, the computer will be turned on If a LackComponentException object is thrown and caught, the
rogram will output the following message
Exception: No missing component
If a NoPowerException object is thrown and caught, the program will output the following message
In main.cpp
Complete the main function to handle the potential exceptions thrown when turning on a desktop computer. Specifically, after a DeskTo
computer is created based on user input, the computer will be turned on If a LackComponentException object is thrown and caught, the
program will output the following message
Exception: No missing component
If a NoPowerException object is thrown and caught, the program will output the following message
Exception: power is not on please check your connection to power outlet.
Ex: if the user enters
the program will output
Exception: No RAM, video card
Current file: main.cpp
#include "DeskTop.h
int hasRAM, hasHardDrive, hasVideoCard, hasPower std::cin hasRAM
std:Cin hasRAM hasHardDrive hasVideoCard hasPower;
TODO: put the following code into the proper exception handling to handle the potential exceptions
DeskTop computerhasRAM hasHardDrive, hasVideoCard, hasPower;
try computerturnOn;
std: :cout "Exception: No egetMissingComponent std: :endl;
catch const NoPowerException& std::cout "Exception: power
return
return I
Please show IDE and output!
Fastbest answers liked!
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
