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 turnOn0 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 (i.e., power==false), 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
01000
the program will output
Exception: No RAM, video card
Current file: main.cpp
1 #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 computer1(hasRAM, hasHardDrive, hasVideoCard, hasPower);
try{ computer1.turnOn(); }
}
3 std: :cout "Exception: No " e.getMissingComponent()"!" std: :endl;
catch (const NoPowerException&){ std::cout "Exception: power
return 0
return 0I
Please show IDE and output!
Fast/best answers liked!
In DeskTop.h class is an empty class. return the

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!