In: Computer Science
The below mentioned figure shows a General diagnosis flowchart
for troubleshooting HP servers. Use
the flowchart to create a C++ program that leads a person through
the steps of fixing a bad HP server.
Here is an example of the program’s output (following one of the
flow):
Starting General Diagnosis Program.
Recoding symptoms information - DONE.
Rebooting server to see if condition still exists - DONE.
Is this a newly installed server? yes [enter]
Please reseat any components that may have come loose during
shipping - DONE.
Rebooting the server - DONE.
Does the condition still exist? no [enter]
Recording all actions taken for future - DONE.
Congratulations, your server problems are solved.
Notice the program ends as soon as a solution is found to the
problem.
CODE:
#include<iostream>
#include<iomanip>
#include<cstring>
#include<bits/stdc++.h>
using namespace std;
int main() {
cout<<"Starting General Diagnosis
Program";
string ans;
cout<<"\nRecording symptoms information - DONE";
// (1)
cout<<"\nRebooting server to see if condition
still exists - DONE";
cout<<"\nIs this a newly installed
server?";
cin>>ans; transform(ans.begin(), ans.end(),
ans.begin(), ::tolower);
if(strcmp(ans.c_str(),"yes")==0) { //(2)
cout<<"\nPlease reseat any
components that may have come loose during shipping - DONE";
cout<<"\nRebooting the
server. - DONE";
cout<<"\nDoes condition still
exist? ";
cin>>ans;
transform(ans.begin(), ans.end(), ans.begin(), ::tolower);
if (strcmp(ans.c_str(),"yes")==0)
{
goto
checkConfigChange;
}
else {
goto
recordAllActions;
}
}
else {
checkConfigChange:
cout<<"\nWere options added
or was the configuration changed recently: ";
cin>>ans;
transform(ans.begin(), ans.end(), ans.begin(), ::tolower);
if (strcmp(ans.c_str(),"yes")==0)
{
cout<<"\nIsolating what has changed - DONE \n Verifying it
was installed correctly - DONE.\n Restoring server to last known
working state or original shipped configuration - DONE";
cout<<"\nDoes condition still exist? ";
cin>>ans;
transform(ans.begin(), ans.end(), ans.begin(), ::tolower);
if
(strcmp(ans.c_str(),"yes")==0) {
IsolateMinMemConfig: //(5)
cout<<"\nIsolating and minimizing the
memory configuration - DONE";
cout<<"\nDoes condition still exist?
";
cin>>ans; transform(ans.begin(),
ans.end(), ans.begin(), ::tolower);
if (strcmp(ans.c_str(),"yes")==0) {
cout<<"\nBreaking
server down to minimal configuration. - DONE";
cout<<"\nDoes condition
still exist? ";
cin>>ans;
transform(ans.begin(), ans.end(), ans.begin(), ::tolower);
if
(strcmp(ans.c_str(),"yes")==0) { //(7)
cout<<"\nTroubleshoot or replace basic server spare parts -
DONE";
cout<<"\nDoes condition still exist? ";
cin>>ans; transform(ans.begin(), ans.end(), ans.begin(),
::tolower);
if
(strcmp(ans.c_str(),"yes")==0) {
//( 8 )
CollectSystemInfo:
cout<<"\n Ensuring whether following
information is available: \n 1. Survey configuration snapshots \n
\
2. OS event log file \n \
3. Full crash dump. - DONE";
}
else
{
cout<<"\n Recording symptom and error
information on repair tag if sending back a failed part -
DONE";
goto end;
}
}
else { //(6)
cout<<"Adding all parts, one part at a time back to
configuration to isolate faulty component . -DONE";
cout<<"\nDoes condition still exist? ";
cin>>ans; transform(ans.begin(), ans.end(), ans.begin(),
::tolower);
if
(strcmp(ans.c_str(),"yes")==0) {
goto CollectSystemInfo;
}
else {
goto recordAllActions;}
}
}
else { goto recordAllActions;}
}
else { goto
recordAllActions;}
}
else {
cout<<"\nChecking for Service Notification - DONE";
//(3)
cout<<"\nDownloading the latest software and firmware from
the HP website - DONE"; //(4)
cout<<"\nDoes condition still exist? ";
cin>>ans;
transform(ans.begin(), ans.end(), ans.begin(), ::tolower);
if
(strcmp(ans.c_str(),"yes")==0) {
goto IsolateMinMemConfig;
}
else { goto
recordAllActions;}
}
}
recordAllActions:
cout<<"\nRecording all actions taken for future
- DONE.";
end:
cout<<"\nCongratulations, your server problems
are solved";
return 0;
callHP:
cout<<"\nPlease Call HP Service Provider.";
//(9)
return 0;
}
Snapshot:
case 1:
Case 2: